Having trouble getting NPM to install dependencies with npm install -d
in my project directory with a defined package.json
file.
Here's my package.json
: https://gist.github.com/3068312
And after wiping my project root's node modules folder (rm -rf node_modules
), I run npm install -d
in my project root and am greeted with this:
(ssh) /vagrant git:master ❯ npm install -d
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info preinstall [email protected]
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 [email protected]
npm info into /vagrant [email protected]
npm info into /vagrant [email protected]
npm info into /vagrant [email protected]
npm info installOne [email protected]
npm info installOne [email protected]
npm info installOne [email protected]
npm info installOne [email protected]
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 [email protected]
npm info unbuild /vagrant/node_modules/underscore
npm ERR! error rolling back [email protected] 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 [email protected]
npm info unbuild /vagrant/node_modules/request
npm ERR! error rolling back [email protected] 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
If I rerun npm install -d
, the error changes to whatever the next package is... if I keep running it it over and over again, it eventually doesn't complain anymore and outputs:
(ssh) /vagrant git:master ❯ npm install -d
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info preinstall [email protected]
npm info build /vagrant
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info ok
However, none of the dependencies for any of these packages get installed. For instance, cheerio
has a few dependencies, so when I try running my test suite, I'm greeted with:
(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)
What gives? I'm on Ubuntu Precise64 in a Vagrant virtual box.
maybe Something wrong related to symlink on vagrant and this issue : https://github.com/isaacs/npm/issues/2380
try
also explained here : http://www.conroyp.com/2013/04/13/symlink-shenanigans-nodejs-npm-express-vagrant/
Have you tried
npm cache clean
?I was having a hell of a time trying to install the dependencies for Qunit the other day and it was due to phantonjs failing to build on the first run, but when I went to reinstall, npm wasn't refetching the binaries and just trying to build from the cached ones. After emptying the cache and rerunning
npm install
it refetched them and was successfully built.