Skip to content

Instantly share code, notes, and snippets.

@bodny
Created April 3, 2018 12:11
Show Gist options
  • Select an option

  • Save bodny/2d6ede3b66bf275c9e4d17c6a177c93b to your computer and use it in GitHub Desktop.

Select an option

Save bodny/2d6ede3b66bf275c9e4d17c6a177c93b to your computer and use it in GitHub Desktop.
NPM - fix permissions as root (WARN EACCESS)

NPM - fix permissions as root (WARN EACCESS)

  • If npm detects it is running as root it drops to a non-privileged user which then doesn't have permissions to write to /root/.node-gyp. The --unsafe-perm option stops it from changing user.
  • e.g. following errors:
    • gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/aglio/node_modules/protagonist/.node-gyp"
    • gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/lib/node_modules/aglio/node_modules/protagonist/.node-gyp/8.11.1"
sudo npm install -g --unsafe-perm homebridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment