I am currently in a directory containing a node_modules
directory
ls
> coverage etc Gruntfile.js lib node_modules npm-debug.log package.json
From this directory, npm install
spits out the following:
npm ERR! Error: Attempt to unlock grunt-contrib-jshint@0.10.0, which hasn't been locked
npm ERR! at unlock (/usr/local/lib/node_modules/npm/lib/cache.js:1434:11)
npm ERR! at cb (/usr/local/lib/node_modules/npm/lib/cache.js:675:5)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:684:20
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:1420:7
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38
npm ERR! at OpenReq.Req.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:144:5)
npm ERR! at OpenReq.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:64:22)
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
I tried npm config set prefix /my/path/ --global
, where /my/path/ contains the node_modules directory. I tried using -g --prefix=/my/path. There's no way to change my install directory, apparently by design. Apparently the one and only way to get npm install working, by design, does not work.
Edit: Here's a hacky workaround I had to use in the meantime. This is obviously not ideal but if your system only has one project, it's fine.
sudo npm install
sudo cp /usr/local/lib/node_modules /my/path/ -R