-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
User "undefined"/"nobody" does not have permission to access the dir #1236
Comments
Same with me. I'm trying to build a docker image with a global install of the firebase-tools, which ends up needing the node-gyp. I'm building the same image for two versions of node: 6.x (LTS ) and v8.x (latest). Locally, both images build fine, but when I try to build in docker hub only the v6.x builds successfully. With the v8.x it gets trapped in the access permissions for This is the Dockerfile: FROM node:latest
USER root
RUN npm install --quiet --no-progress -g @angular/cli@latest firebase-tools
RUN npm cache clean --force And this is part of the output: Step 4/5 : RUN npm install --quiet --no-progress -g @angular/cli@latest firebase-tools
---> Running in fce3da11b04e
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/bin/firebase
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
> node-sass@4.5.3 install /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass
> node scripts/install.js
Unable to save binary /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/vendor/linux-x64-57 : { Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/vendor'
at Object.fs.mkdirSync (fs.js:890:18)
at sync (/usr/local/lib/node_modules/@angular/cli/node_modules/mkdirp/index.js:71:13)
at Function.sync (/usr/local/lib/node_modules/@angular/cli/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/scripts/install.js:111:11)
at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/scripts/install.js:154:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/vendor' }
> grpc@1.3.8 install /usr/local/lib/node_modules/firebase-tools/node_modules/grpc > node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.3.8/node-v57-linux-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for grpc@1.3.8 and node@8.1.2 (node-v57 ABI) (falling back to source compile with node-gyp)
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/firebase-tools/node_modules/grpc/.node-gyp"
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.1.2" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp"
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.1.2" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp"
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.1.2" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp"
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.1.2" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp"
(infinite loop) |
Both seem to be issues with node-sass's post-install scripts + insufficient permissions. You could try The 'user "undefined"' warning is because the USER environment variable isn't set. |
@bnoordhuis Indeed, I understand now that it doesn't seem to be a problem with node-gyp. But I already had set the USER to either However, I was able to get it working by changing the default @kingjerod maybe it will work for you as well: USER node
RUN mkdir /home/node/.npm-global
ENV PATH=/home/node/.npm-global/bin:$PATH
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global |
Doing what @gabrielaraujof suggested I could not create /var/www to copy my app files to. Tried to chmod and chown without success. Any suggestion? |
Installing Angular 4 CLI on macOS: for some reason root user can't create hidden folders, folder names beginning with '.'. So cd to "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/" in the command-line shell and do a "mkdir .node-gy." Re-run "sudo npm install -g @angular/cli." Install will finish. |
@gabrielaraujof fix does not work for me. |
@gabrielaraujof fix helped me! |
You could add --unsafe to your npm install command. Found it via npm/npm#1259 |
@ julianonunes
|
@gibfahn actually I don't remember, but what I've been using successfully so far is this:
|
@phani1kumar add |
@BoiseBaked solution worked for me. |
@gabrielaraujof solution worked for me as well, it's also an officially recommended way to solve permission errors. npm guide I haven't seen any actual problems when sudo install, but they recommend not to, so, I guess this is the best possible solution. Dockerfile I used
|
npm_config_user=root npm install -g ... works for me |
Doing this before
|
This works for me too: #1236 (comment) But I have no idea whether it's the right thing to do or whether there is a real bug somewhere. |
I added "npm config set user root" before npm install |
Switched to |
As simple user try |
sudo yarn add global <package> |
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:
The text was updated successfully, but these errors were encountered: