node-gyp: Permission denied
I can't install the latest, 0.7.5, on my ubuntu server. This is giving me strong deja vu. I think I've seen this on other modules and maybe on bcrypt before. I don't remember how I got past it. Maybe the problem has to do with installing while logged in as root? Here is the error:
$ npm install bcrypt
npm http GET https://registry.npmjs.org/bcrypt
npm http 304 https://registry.npmjs.org/bcrypt
npm http GET https://registry.npmjs.org/bindings/1.0.0
npm http 304 https://registry.npmjs.org/bindings/1.0.0
> [email protected] install /ri/node_modules/bcrypt
> node-gyp rebuild
sh: 1: node-gyp: Permission denied
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 127
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.2.0-31-virtual
npm ERR! command "/root/.nvm/v0.10.0/bin/node" "/root/.nvm/v0.10.0/bin/npm" "install" "bcrypt"
npm ERR! cwd /ri
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /ri/npm-debug.log
npm ERR! not ok code 0
You have permission problems. Fix them.
It appears that node and npm were installed under root and into a directory controlled by root. Normally the bash prompt for non root is $. Since that is what appears in your output I'd guess that you're using the wrong user to install the module. But, as @shtylman noted, this is definitely environmental.
Thanks. I've always run as root and therefore thought it was impossible to have permission problems. I don't even know what gyp is so I'm going to have a bit of a problem figuring out where the permission problem is.
On Thu, Mar 21, 2013 at 7:19 PM, Nick Campbell [email protected]:
It appears that node and npm were installed under root and into a directory controlled by root. Normally the bash prompt for non root is $. Since that is what appears in your output I'd guess that you're using the wrong user to install the module. But, as @shtylmanhttps://github.com/shtylmannoted, this is definitely environmental.
— Reply to this email directly or view it on GitHubhttps://github.com/ncb000gt/node.bcrypt.js/issues/153#issuecomment-15277731 .
So, after a little digging on the tubes I came across https://github.com/isaacs/npm/issues/294.
I'm guessing that you'll need to use npm install bcrypt --unsafe-perms
Thanks you very much. I gave it a quick try and still had the problem but you've given me a head start on figuring this out. I'm a real noob when it comes to permissions but this will be a good forced lesson.
On Thu, Mar 21, 2013 at 7:57 PM, Nick Campbell [email protected]:
So, after a little digging on the tubes I came across isaacs/npm#294https://github.com/isaacs/npm/issues/294 .
I'm guessing that you'll need to use npm install bcrypt --unsafe-perms
— Reply to this email directly or view it on GitHubhttps://github.com/ncb000gt/node.bcrypt.js/issues/153#issuecomment-15278667 .
BTW, I put the prompt $ in my sample output but I just did that to remove the long prompt that was there. I'm always logged in as root. I do sudo -i every time I start a session. I've used unix/linux on and off for 35 years (not a typo) and I've never logged in as anything but root. I know it is supposed to be dangerous but I've never understood why. I've never typed rm -rf / and I don't plan to.
This helped me: http://stackoverflow.com/questions/2009278/python-multiprocessing-permission-denied
This solves the issue: https://github.com/jansmolders86/mediacenterjs/issues/191#issuecomment-101188637
Adding a non-root user and installing node there helped me.
This is quite dummy solution, but in my case, after trying all of your suggestions out, only deleting node v8.4.0 and installing v9.2.0 (all done as non-root) helped. I have to admit, that I have no clue about the reason of this issue.
Hi all,
following this commend working fine...:)
#npm install -g node-gyp node-pre-gyp or $sudo npm install -g node-gyp node-pre-gyp
npm install --unsafe-perm
npm install --unsafe-perm
Thanks bro!!! It worked
npm install --unsafe-perm
Great worked thanks :)
Hi all, following this commend working fine...:)
#npm install -g node-gyp node-pre-gypor$sudo npm install -g node-gyp node-pre-gyp
thank you you saved a few hours of scratching my head i just installed npm install -g node-gyp node-pre-gyp and and it fixed my the problem i was having with installing bcrypt