Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation and linking with npm fails if folder is not owned by root on Linux #4

Open
mattheworiordan opened this issue Sep 15, 2012 · 6 comments

Comments

@mattheworiordan
Copy link

Hi there

When I run the command sudo npm link your NPM is failing. However, when I run locally it works, but when I run on my Ubuntu server where there are non-standard permissions set on the application folder, the install fails. I have tried setting up the repository in the ubuntu home folder, and then running sudo npm link and it works fine, but when I put the repository in /var/[my app]/ and set permissions on those folders to allow a specific user and group, it no longer works.

Do you have any idea what may be causing this?

Thanks for your help
Matt

Here is the output

npm http GET https://registry.npmjs.org/murmurhash3
npm http GET https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/murmurhash3
npm http 304 https://registry.npmjs.org/ws

> murmurhash3@0.1.1 install /var/my-app/core/node_modules/murmurhash3
> node-gyp rebuild

npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/tinycolor
npm http GET https://registry.npmjs.org/options
gyp ERR! rebuild error Error: EACCES, mkdir '/var/my-app/core/node_modules/murmurhash3/build'
gyp ERR! not ok 
npm ERR! murmurhash3@0.1.1 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the murmurhash3@0.1.1 install script.
npm ERR! This is most likely a problem with the murmurhash3 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 murmurhash3
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.0-30-generic
npm ERR! command "node" "/usr/local/bin/npm" "link"
npm ERR! cwd /var/my-app/core
npm ERR! node -v v0.6.20
npm ERR! npm -v 1.1.37
npm ERR! code ELIFECYCLE
npm ERR! message murmurhash3@0.1.1 install: `node-gyp rebuild`
npm ERR! message `sh "-c" "node-gyp rebuild"` failed with 1
npm http 304 https://registry.npmjs.org/tinycolor
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/options
@hideo55
Copy link
Owner

hideo55 commented Oct 23, 2012

It may be a problerm of node-gyp.
See github.com/nodejs/node-gyp/issues/116

@hideo55 hideo55 closed this as completed Oct 23, 2012
@mattheworiordan
Copy link
Author

It's not a problem with node-gyp, in fact when I use --unsafe-perm this NPM works.

@mattheworiordan
Copy link
Author

Quite odd to close an issue without even trying to find the problem btw.

@hideo55 hideo55 reopened this Oct 23, 2012
@mattheworiordan
Copy link
Author

FYI, I spoke with my colleague who figured out the --unsafe-perm workaround, and here is what he told me on IM:

the install scripts are run without sudo, even if the npm install/link is run with sudo
so it's failung because the install script requires a permission that it doesn't have
that's why --unsafe-perm works
because that means all scripts inherit the permissions of whoever invoked npm
so without --unsafe-perm the scripts run as nobody
I think I read that you can run the npm command and specify a user to use to run the scripts

@mattheworiordan
Copy link
Author

Also:

if you want to set a specific user to run the scripts - eg not root but not nobody, you can do:
npm config set user <uid> [--global]

@hideo55
Copy link
Owner

hideo55 commented Oct 23, 2012

Thanks for the information.

ning-yu pushed a commit to volumio/Volumio2 that referenced this issue Feb 5, 2015
package.json
- Add node-spotify
- Add version and repo info

NOTE: During node-spotify install, if build fails with error EACCES, you may need to run install with "sudo" or with flag "--unsafe-perm". See hideo55/node-murmurhash3#4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants