NPM n'installe pas de dépendances?


8

Ayant du mal à obtenir NPM pour installer les dépendances avec npm install -ddans mon répertoire de projet avec un package.jsonfichier défini .

Voici mon package.json: https://gist.github.com/3068312

Et après avoir effacé le dossier des modules de nœud de la racine de mon projet ( rm -rf node_modules), je lance npm install -ddans ma racine de projet et je suis accueilli par ceci:

(ssh) /vagrant git:master ❯ npm install -d                                                                                                                                                                  
npm info it worked if it ends with ok
npm info using npm@1.1.4
npm info using node@v0.6.12
npm info preinstall redeye@0.0.1
npm http GET https://registry.npmjs.org/sinon
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/mocha
npm http GET https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/sinon
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/mocha
npm http 304 https://registry.npmjs.org/request
npm info into /vagrant underscore@1.3.3
npm info into /vagrant mocha@1.3.0
npm info into /vagrant sinon@1.3.4
npm info into /vagrant request@2.9.203
npm info installOne underscore@1.3.3
npm info installOne mocha@1.3.0
npm info installOne sinon@1.3.4
npm info installOne request@2.9.203
npm info unbuild /vagrant/node_modules/underscore
npm info unbuild /vagrant/node_modules/mocha
npm info unbuild /vagrant/node_modules/sinon
npm info unbuild /vagrant/node_modules/request
npm ERR! error installing underscore@1.3.3
npm info unbuild /vagrant/node_modules/underscore
npm ERR! error rolling back underscore@1.3.3 Error: UNKNOWN, unknown error '/vagrant/node_modules/underscore'

npm ERR! Error: ENOENT, no such file or directory '/vagrant/node_modules/underscore/package.json'
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /vagrant/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.2.0-23-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-d"
npm ERR! cwd /vagrant
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! path /vagrant/node_modules/underscore/package.json
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory '/vagrant/node_modules/underscore/package.json'
npm ERR! errno {}
npm ERR! error installing request@2.9.203
npm info unbuild /vagrant/node_modules/request
npm ERR! error rolling back request@2.9.203 Error: UNKNOWN, unknown error '/vagrant/node_modules/request'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /vagrant/npm-debug.log
npm not ok

Si je réexécute npm install -d, l'erreur se transforme en quelque chose du prochain paquet ... si je continue à l'exécuter encore et encore, il finit par ne plus se plaindre et affiche:

(ssh) /vagrant git:master ❯ npm install -d                                                                                                                                                               
npm info it worked if it ends with ok
npm info using npm@1.1.4
npm info using node@v0.6.12
npm info preinstall redeye@0.0.1
npm info build /vagrant
npm info linkStuff redeye@0.0.1
npm info install redeye@0.0.1
npm info postinstall redeye@0.0.1
npm info ok

Cependant, aucune des dépendances de l'un de ces packages n'est installée. Par exemple, cheerioa quelques dépendances, donc quand j'essaie d'exécuter ma suite de tests, je suis accueilli avec:

(ssh) /vagrant git:master ❯ mocha --compilers coffee:coffee-script --watch spec/*                                                                                                                           


node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Cannot find module 'cheerio-select'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)

Ce qui donne? Je suis sur Ubuntu Precise64 dans une boîte virtuelle Vagrant .

Réponses:


1

peut-être quelque chose de mal lié au lien symbolique sur vagabond et à ce problème: https://github.com/isaacs/npm/issues/2380

essayer

npm install --no-bin-link

également expliqué ici: http://www.conroyp.com/2013/04/13/symlink-shenanigans-nodejs-npm-express-vagrant/


Lors de l'essai du didacticiel Docker prakhar.me/docker-curriculum/#dockerrun, la même erreur se produit lors de l'exécution de root @ ip-172-31-22-20: ~ / docker-curriculum # docker build -t ashishkarpe / foodtrucks-web.
Ashish Karpe

0

As-tu essayé npm cache clean?

L'autre jour, j'avais beaucoup de mal à essayer d'installer les dépendances pour Qunit et cela était dû au fait que phantonjs n'avait pas construit sur la première exécution, mais quand je suis allé réinstaller, npm ne récupérait pas les binaires et essayait simplement de construire à partir de ceux mis en cache. Après avoir vidé le cache et npm installrelancé, il les a récupérés et a été correctement construit.

En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.