On my macbook air I can only install npm packages globally using sudo but anytime I go into a local directory and try to install a local package without the -g it gives me errors.
npm ERR! Error: EACCES, open '/Users/mmarze/.npm/53951495-coffee-script.lock'
npm ERR! { [Error: EACCES, open '/Users/mmarze/.npm/53951495-coffee-script.lock']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/mmarze/.npm/53951495-coffee-script.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" "coffee-script"
npm ERR! cwd /Users/mmarze/sandbox/node.js/test
npm ERR! node -v v0.8.9
npm ERR! npm -v 1.1.61
npm ERR! path /Users/mmarze/.npm/53951495-coffee-script.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/mmarze/.npm/53951495-coffee-script.lock'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/mmarze/sandbox/node.js/test/npm-debug.log
npm ERR! not ok code 0
I tried uninstalling and reinstalling node and npm and I can't get it to install anything locally, and if I use sudo to install locally then my local user doesn't have write access to them. How can I fix this?
Based on the comment from Linus G Thiel it looks like this fixes the issue:
Looks like you may have done a
sudo npm install ...
without-g
, i.e. installed npm packages in your home as the root user. Either clear your.npm
directory orchown -R mmarze.mmarze ~/.npm
should fix it.
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