EACCES, Permission denied error #194

Closed
kavenyan opened this Issue Aug 24, 2010 · 7 comments

Projects

None yet

7 participants

@kavenyan

I run "sudo npm install yui3", errors is #191, I run "ulimit -n 64",and try again ,but the errors still exist. I run "npm help install", the info is :

kaven:nodejs-yui3 kaven$ npm help install
npm it worked if it ends with ok
npm cli [ 'help', 'install' ]
npm version 0.1.26
npm config file /Users/kaven/.npmrc
npm config file /usr/local/etc/npmrc
npm ! ERROR !
npm ! ERROR ! Error: Failed to make /usr/local/lib/node/.npm/.tmp while ensuring /usr/local/lib/node/.npm/.tmp
npm ! ERROR ! EACCES, Permission denied '/usr/local/lib/node/.npm/.tmp'
npm ! ERROR ! at MKDIRCB (/usr/local/lib/node/.npm/npm/0.1.26/package/lib/utils/mkdir-p.js:30:29)
npm ! ERROR ! at node.js:764:9
npm ! ERROR !
npm failure try running: 'npm help help'
npm failure Report this entire log at http://github.com/isaacs/npm/issues
npm failure or email it to npm-@googlegroups.com
npm not ok

@isaacs
Member
isaacs commented Aug 24, 2010

If you use sudo with npm, you need to use sudo with npm all the time.

Don't use sudo. Do this instead:

sudo chown -R $USER /usr/local/

and then never use sudo again with npm.

http://foohack.com/2010/08/intro-to-npm/#what_no_sudo

@kavenyan

Yes, I see , thank you.

@yigitgenc

It helped! Thanks!

@kumarharsh

I still find this a very problematic issue:

@isaacs : I have tried your solution: http://foohack.com/2010/08/intro-to-npm/#what_no_sudo
If I now make a file manually at /usr/lib, it works, and also works for some packages.

But, npm install -g fails for some packages, which try to make a symlink (to /usr/bin I suppose). I guess there is no solution but to use sudo then, is there?

@codesspark

THankyoU

@thanhcs94

it helped , ThaNk yoU so much @isaacs

@exos
exos commented Dec 22, 2016 edited

Don't use sudo. Do this instead:

sudo chown -R $USER /usr/local/

WTF!!!!!!
DON'T DO THAT!!!

Only use sudo for global packages, ej:

sudo npm install -g gulp

For local packages don't use sudo:

npm install --save local_package

If you already use'd sudo for install local packages, you can fix it:

chown $UID:$GID -R node_modules

Given permissions on /usr/local is very insecure and non-posix solution. Sincerely I'm surprised than a member recomends such atrocity.

In /usr/local there are binaries (maybe with +S execution permissions) who can be rootkited by a software runs in user-space.

Please don't do that.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment