web-dev-qa-db-fra.com

Problème lorsque j'exécute npm install sur le menu fixe

Travaillant sur le même projet qu’un collègue, lors de l’exécution de l’installation de npm, j’ai le problème suivant, même si aucun de mes collègues n’a le même problème. Nous utilisons tous l'environnement Docker, les conteneurs Linux. 

C'est l'erreur:

npm install
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

> [email protected] install /var/www/node_modules/node-sass
> node scripts/install.js

fs.js:113
    throw err;
    ^

Error: EINVAL: invalid argument, open '/var/www/node_modules/node-sass/package.json'
    at Object.openSync (fs.js:434:3)
    at Object.readFileSync (fs.js:339:35)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:706:20)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/var/www/node_modules/node-sass/lib/extensions.js:7:9)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/gauge/node_modules/is-fullwidth-code-point'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/sass-graph/node_modules/camelcase'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/gauge/node_modules/string-width'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/sass-graph/node_modules/is-fullwidth-code-point'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/sass-graph/node_modules/string-width'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/abbrev'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/assert-plus'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/aws-sign2'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/caseless'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/console-control-strings'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/aws4'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/forever-agent'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/extend'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/has-unicode'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/block-stream'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/is-typedarray'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/isstream'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/jsbn'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/lodash.mergewith'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/lodash.clonedeep'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/oauth-sign'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/safer-buffer'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/node-sass/node_modules/ansi-styles'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/osenv'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/node-sass/node_modules/supports-color'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/tunnel-agent'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/node-sass/node_modules/chalk'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/yargs-parser/node_modules/camelcase'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/bcrypt-pbkdf'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/tweetnacl'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/npmlog'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/are-we-there-yet'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/wide-align'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/true-case-path'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/node-gyp/node_modules/semver'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/asynckit'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/async-foreach'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/dashdash'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/delayed-stream'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/extsprintf'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/delegates'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/node-sass/node_modules/cross-spawn'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/combined-stream'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/getpass'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/har-validator'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/json-stringify-safe'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/in-publish'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/har-schema'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/form-data'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/nopt'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/nan'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/verror'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/tough-cookie'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/jsprim'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/ecc-jsbn'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/qs'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/request'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/gaze'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/http-signature'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/globule'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/tar'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/fstream'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/sass-graph/node_modules/yargs'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/json-schema'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/performance-now'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/asn1'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/scss-tokenizer/node_modules/source-map'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/stdout-stream'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/sshpk'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/laravel-mix'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/node-gyp/node_modules/semver'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/sass-graph/node_modules/is-fullwidth-code-point'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/gauge/node_modules/is-fullwidth-code-point'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/scss-tokenizer/node_modules/source-map'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/yargs-parser/node_modules/camelcase'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/node_modules/node-sass/node_modules/chalk'
npm WARN [email protected] requires a peer of popper.js@^1.14.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of imagemin@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","Arch":"any"} (current: {"os":"linux","Arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-08-30T10_12_31_719Z-debug.log

J'essaie:

  • rm -rf node_modules
  • rm package-lock.json yarn.lock
  • npm cache clear --force
  • npm config set user 0
  • npm config set unsafe-perm true
  • npm installer -g sm
  • npm installer
  • npm install --no-bin-links

Mais sans succès.

Merci

5
Cláudio

npm install est en chute lors de l'installation de node-sass. J'ai personnellement fait face à ce problème plusieurs fois et la commande npm rebuild node-sass m'aide toujours.

J'espère que ça vous concerne aussi :)

1
Rajeev Ranjan

Étant donné que la variable readFileSync/openSync échoue, cela peut être lié à des problèmes de synchronisation de fichiers entre Docker et votre hôte (Windows). Il échoue dans /var/www, qui est probablement le dossier que vous partagez en tant que volume dans le conteneur Docker.

En ce qui concerne la solution de contournement, vous pouvez exclure un sous-dossier node_modules et le rendre persistant .

Si vous utilisez docker-compose.yml, montez un volume de menu fixe persistant à la place de votre répertoire local node_modules, par exemple.

...
  volumes:
    - .:/var/www
    - node_modules:/var/www/node_modules

Voir: Ajouter un volume à Docker, mais exclure un sous-dossier

Problème lié à GitHub: EINVAL: argument non valide, ouvrez 'node-sass/package.json' .

Consultez également la page de dépannage de node-sass .

Question connexe: npm installer sur laradock ne fonctionne pas .

0
kenorb

J'ai un Windows 10 avec menu fixe et j'utilise la solution de contournement suivante. Dans le menu fixe, chez moi, je crée un répertoire, par exemple: 

/ home/mon_projet/node_modules.

Dans mon répertoire mappé sous Windows et Linux (dans le menu fixe), je crée un lien symbolique dans le répertoire que j'ai créé avant un "nœud_modules". Quelque chose comme

ls-src dest

ln -s/home/my_project/node_modules/var/www/html/my_project/node_modules

Eux, dans mon projet j'appelle le

npm installer

Avec cette solution, le noeud-sass s’installe sans problème.

Je ne suis pas un expert, mais je pense que le problème vient de la cartographie sous Windows et Linux et de la façon dont npm installe avec des liens ce paquet.

Meilleures salutations

0
Jose Juan Calvo