Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM install fails

I am currently unable to install NPM on Mac OS, I have looked all over the place for someone with the same error, but I can't seem to find any. Could anyone give me a hand? This is what I get after running the curl command to install NPM:

All clean!
npm-install-94139.sh: line 302: 94407 Segmentation fault: 11  "$node" cli.js rm npm -gf
npm ERR! addLocal Could not install .
npm ERR! Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock'
npm ERR!  { [Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.5.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package
npm ERR! node -v v0.8.19
npm ERR! npm -v 1.1.71
npm ERR! path /Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package/npm-debug.log
npm ERR! not ok code 0
It failed
like image 972
schlow Avatar asked Nov 27 '22 09:11

schlow


1 Answers

The solution on this other question seems better than messing around with NVM - npm throws error without sudo

SOLUTION: You need to unlock permissions in home directory, like Noah says.

sudo chown -R `whoami` ~/.npm

You also need to write it to your library as well, like Xilo says.

sudo chown -R `whoami` /usr/local/lib/node_modules
like image 80
jolyonruss Avatar answered Dec 05 '22 21:12

jolyonruss