nodejs / node-gyp

Node.js native addon build tool
MIT License
9.94k stars 1.8k forks source link

"root does not have access" causing inf loop #408

Closed kulicuu closed 10 years ago

kulicuu commented 10 years ago

See (closed) issue #407

from builderror.log [...] gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/wylie/tmp/.node-gyp/0.10.25" gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/wylie/tmp/.node-gyp" gyp verb command install [ 'v0.10.25' ] gyp verb install input version string "v0.10.25" gyp verb install installing version: 0.10.25 gyp verb install --ensure was passed, so won't reinstall if already installed gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/wylie/tmp/.node-gyp/0.10.25" gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/wylie/tmp/.node-gyp" gyp verb command install [ 'v0.10.25' ] gyp verb install input version string "v0.10.25" gyp verb install installing version: 0.10.25 gyp verb install --ensure was passed, so won't reinstall if already installed gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/wylie/tmp/.node-gyp/0.10.25" gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/wylie/tmp/.node-gyp" gyp verb command install [ 'v0.10.25' ] gyp verb install input version string "v0.10.25" [...]

kulicuu commented 10 years ago

As suggested by the error, normal non-sudo non-global install works fine.

It might be worth keeping this open if it's worth investigating, but it's no longer critical for me, as I'll just switch away from global installs for these items.

btw: Thanks for the great software !

yorkie commented 10 years ago

+1 same problem in my server.

chadkouse commented 10 years ago

:+1: big problem for me running my node.js application on elastic beanstalk

TooTallNate commented 10 years ago

Perhaps we should add a check for when the "temporary dev dir" matches the default dev dir and then throw an error or something.

The real solution though is to not run node-gyp as root... ever...

chadkouse commented 10 years ago

well I take it back - Maybe something else is causing my problem because elastic beanstalk is not running anything as root.

I was trying to manually run the deployment scripts when I got this error.. after noticing node-gyp running for 20 min during the deployment process...

stowns commented 10 years ago

'big problem for me running my node.js application on elastic beanstalk'

+1

chadkouse commented 10 years ago

I got nailed by this again last night....

kulicuu commented 10 years ago

Ah wow haven't seen this in awhile.
I know how to fix this now!

At least this worked for me:

sudo npm --unsafe-perm=true install -g [...]

You need to do that --unsafe-perm=true flag set to true. I forget why. It works.

https://www.npmjs.org/doc/misc/npm-config.html

stowns commented 10 years ago

@kulicuu this worked perfectly for me on ASW Elastic Beanstalk NPM_CONFIG_UNSAFE_PERM=true ftw.

kulicuu commented 10 years ago

Ha great. So I'll be cautiously optimistic that this fix will work for everyone and close the issue.