Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

node-gyp: Permission denied #153

Closed
mark-hahn opened this Issue Mar 20, 2013 · 9 comments

Comments

Projects
None yet
6 participants

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

> bcrypt@0.7.5 install /ri/node_modules/bcrypt
> node-gyp rebuild

sh: 1: node-gyp: Permission denied
npm ERR! bcrypt@0.7.5 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 127
npm ERR!
npm ERR! Failed at the bcrypt@0.7.5 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
Collaborator

defunctzombie commented Mar 20, 2013

You have permission problems. Fix them.

Collaborator

ncb000gt commented Mar 22, 2013

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 notifications@github.comwrote:

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
.

Collaborator

ncb000gt commented Mar 22, 2013

So, after a little digging on the tubes I came across isaacs/npm#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 notifications@github.comwrote:

So, after a little digging on the tubes I came across isaacs/npm#294isaacs/npm#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.

Adding a non-root user and installing node there helped me.

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