jdx / npm-register

Your own private npm registry and backup server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-gyp permissions issue with installing latest version (2.5.2)

jessebye opened this issue · comments

On trying to install the latest version via sudo npm install -g npm-register (Ubuntu 14.04, Node 8.5.0) it hangs with:

**gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/npm-register/node_modules/bcrypt/.node-gyp/8.5.0"
**

This error continues to repeat indefinitely. Had to do a npm config set unsafe-perm true before I could complete the install.

I recommend changing your permissions with this guide from NPM. You shouldn't be installing things as root unless you need to. Can you try changing your NPM permissions and reinstalling?

EDIT: hope that didn't come off as condescending, trying to rule out obvious reasons.

@dgautsch definitely understand what you're saying, but we do this for a bunch of other packages and they don't have a problem. It seems to be specific to npm-register. I would go with non-sudo install if I could but we have our server automation all set to use sudo for global npm installs at this time and it would take some work to retool everything.

Found this on another thread about npm global installs:

Using sudo is fine. npm will not run arbitrary build scripts as root, if you're root -- it chown's the package dir to nobody and then runs scripts as nobody.

If packages do other non-gyp things in their install scripts, then they are broken. Complain to the authors.

If you really really need to run package scripts as root, then set the unsafe-perm config to true.

Thus I'm complaining to the authors 😄

commented

@jdxcode confirmed it is bcrypt.

Closing this issue out as it was a environment issue.