I currently have node.js version 0.8.8, and npm 1.1.59 installed.
Whenever I run:
$ npm install -g express
I get this in return:
npm ERR! Error: EACCES, open '/Users/devinandrews/.npm/64a534c1-express.lock' npm ERR! { [Error: EACCES, open '/Users/devinandrews/.npm/64a534c1-express.lock'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/Users/devinandrews/.npm/64a534c1-express.lock' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! System Darwin 12.1.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "express" npm ERR! cwd /Users/devinandrews npm ERR! node -v v0.8.8 npm ERR! npm -v 1.1.59 npm ERR! path /Users/devinandrews/.npm/64a534c1-express.lock npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, open '/Users/devinandrews/.npm/64a534c1-express.lock' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/devinandrews/npm-debug.log npm ERR! not ok code 0
I'm pulling my hair out right now trying to figure this out.
Update:
I ran
$ npm -g ls
to see my what npm has installed globally:
/usr/local/lib ├─┬ [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ ├── [email protected] │ │ ├── [email protected] │ │ ├── [email protected] │ │ └── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ └─┬ [email protected] │ └── [email protected] └─┬ [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├─┬ [email protected] │ └── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├─┬ [email protected] │ └── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├─┬ [email protected] │ └─┬ [email protected] │ └── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├─┬ [email protected] │ └── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] └── [email protected]
but if i run:
$ npm ls
it returns empty?
If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).
I had the same problem, and npm cache clear
did not fix it. This problem is caused because the .npm
directory in your home directory was created with root privileges. Most likely the first npm command you ran was sudo npm -g
and now you are trying to npm install
in a local directory.
To solve:
sudo chown -R yourusername ~/.npm
rmdir ~/tmp
npm install
from package.json should work after this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With