question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

User "undefined"/"nobody" does not have permission to access the dir

See original GitHub issue

I’m not sure if this is a problem with a newer version of Node or this package.

This is using Docker, with image FROM node:8.1

I’m trying to globally install the spectacle-docs package npm install -g spectacle-docs. It attempts to use node-gyp at one point and cannot create a directory with user “undefined”, so it tries to use a local temp directory and then has an error about user “nobody”, and ends up going into an infinite loop trying to rebuild.

I’ve tried deleting the directory and re-doing install numerous times, no luck.

Output:

> node-sass@4.5.3 postinstall /usr/local/lib/node_modules/spectacle-docs/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node /usr/local/lib/node_modules/spectacle-docs/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli   '/usr/local/lib/node_modules/spectacle-docs/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.6.2
gyp info using node@8.1.2 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.9\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.1.2
gyp verb command install [ '8.1.2' ]
gyp verb install input version string "8.1.2"
gyp verb install installing version: 8.1.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/root/.node-gyp/8.1.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/spectacle-docs/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.2' ]
gyp verb install input version string "8.1.2"
gyp verb install installing version: 8.1.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.2
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/spectacle-docs/node_modules/node-sass/.node-gyp/8.1.2
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/local/lib/node_modules/spectacle-docs/node_modules/node-sass/.node-gyp/8.1.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/spectacle-docs/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.2' ]
gyp verb install input version string "8.1.2"
gyp verb install installing version: 8.1.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.2
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/spectacle-docs/node_modules/node-sass/.node-gyp/8.1.2
(This will loop forever)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:21
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

159reactions
phani1kumarcommented, Sep 7, 2017

You could add --unsafe to your npm install command. npm install -g your-package --unsafe

Found it via https://github.com/npm/npm/issues/1259

28reactions
asottilecommented, Oct 11, 2018
npm_config_user=root npm install -g ...

works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

No access permission error with npm global install on docker ...
I was able to get it working by changing the default npm-global directory. This is my dockerfile now: FROM node:latest USER node RUN...
Read more >
Solved : EACCES current user ("nobody") does not have ...
Solved EACCES current user ("nobody") does not have permission to access the dev dir by adding "--unsafe" to end of command.
Read more >
user "nobody/undefined" does not have permission to access the ...
Running it on docker image node:7-alpine with node v7.10.1 and npm v4.2.0 results in this: [...] ... node-gyp/7.10.1" gyp WARN EACCES attempting to...
Read more >
SELinux User's and Administrator's Guide Red Hat Enterprise ...
SELinux policy rules are not used if DAC rules deny access first, which means that no SELinux denial is logged if the traditional...
Read more >
Troubleshooting IAM policies - AWS Identity and Access ...
So if you are not signed in as the root user, you must have permissions granted by a policy. Specifying multiple services in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found