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

Infinite Loop with Docker / npm -g install @angular/cli #7389

Closed
moloch-- opened this issue Aug 14, 2017 · 18 comments
Closed

Infinite Loop with Docker / npm -g install @angular/cli #7389

moloch-- opened this issue Aug 14, 2017 · 18 comments

Comments

@moloch--
Copy link

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Node v8.3.0
NPM v5.3.0

OS: Docker buildpack-deps:jessie

Repro steps.

docker build

The log given by the failure.

RUN npm install -g @angular/cli

...removed...

> [email protected] postinstall /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node /usr/local/lib/node_modules/@angular/cli/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/@angular/cli/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 [email protected]
gyp info using [email protected] | 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.3.0
gyp verb command install [ '8.3.0' ]
gyp verb install input version string "8.3.0"
gyp verb install installing version: 8.3.0
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.3.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@angular/cli/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.3.0' ]
gyp verb install input version string "8.3.0"
gyp verb install installing version: 8.3.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.3.0
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.3.0
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.3.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@angular/cli/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.3.0' ]
gyp verb install input version string "8.3.0"

...repeating infinitely...

Note RUN npm install -g node-gyp seems to work fine.

Desired functionality.

Installs properly

Mention any other details that might be useful.

N/A

@rhuiser
Copy link

rhuiser commented Aug 15, 2017

Having same issue.

@TravisFabel
Copy link

I am also having the same issue.

@daBishMan
Copy link

Same here

@treeder
Copy link

treeder commented Aug 16, 2017

workaround is here: nodejs/node-gyp#1236 (comment)

@moloch--
Copy link
Author

Okay the nodejs/node-gyp#1236 trick/workaround seems to fix it:

USER node
RUN mkdir /home/node/.npm-global
ENV PATH=/home/node/.npm-global/bin:$PATH
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
RUN npm install -g @angular/cli

@daBishMan
Copy link

daBishMan commented Aug 21, 2017

Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 8.x

Found bindings for the following environments:

  • Linux 64-bit with Node.js 7.x

when I am running when I try to launch ng tests using PhantomJS I get the above error? anyone able to shed some light on why? or how I can resolve it

I attempted node-sass rebuild and that did not work

@johanchouquet
Copy link

Same here. What I don't get is why there's no problem of user when using node 7.9.0.

For now, i'm keeping node 7.9.0.

@kirillgroshkov
Copy link

Same here!

@pstephenwille
Copy link

pstephenwille commented Nov 5, 2017

Same here, and I'm not using Docker on this project, but it is installed on my machine. Angular-cli should have installed as root:root

drwxr-xr-x 8 root root 4096 Nov 4 17:06 ./

drwxr-xr-x 5 root root 4096 Nov 3 16:02 ../

drwxr-xr-x 3 root root 4096 Nov 4 15:58 @angular/

drwxr-xr-x 14 nobody stephen 4096 Nov 3 16:02 angular-cli/

drwxr-xr-x 7 root root 4096 Nov 4 17:06 firebase-tools/

drwxr-xr-x 12 nobody stephen 4096 Nov 3 16:12 npm/

drwxr-xr-x 3 root root 36864 Nov 4 17:06 .staging/

drwxr-xr-x 9 root root 4096 Nov 4 15:40 webpack/

This fixed it though: sudo chown -R root:root .

mkfsn added a commit to mkfsn/shucyan that referenced this issue Nov 8, 2017
weronikadominiak pushed a commit to CodeForPoznan/volontulo that referenced this issue Dec 20, 2017
Upgrading Node (fixes #762)

Issue with insufficient directory permissions
see: angular/angular-cli#7389
@muzfr7
Copy link

muzfr7 commented Jan 8, 2018

Same on MacOS High Sierra (node v8.9.4 and npm 5.6.0) below statement looping for more than 2 hours now..
gyp WARN install version not already installed,, continuing with install 8.9.4

Just exited out of installation using Control+C and ng -v works fine :)

@PhilThurston
Copy link

This bug is still reproducible on Ubuntu Xenial and Debian Jessie. I appreciate that there is a workaround but shouldn't the issue remain open since there is no actual fix just workarounds?

For those coming from google to quickly get around this use this command to install:

npm install -g @angular/cli --unsafe

the --unsafe gets it to complete without the loop

@Epicnessism
Copy link

I see that this thread is now closed. Has there been an actual fix or is everyone still just using the --unsafe command? I got a similar error when installing today. The unsafe command fixed the infinite loop issue for me as well.

@sethkoch
Copy link

sethkoch commented Feb 8, 2018

Actually, if you just control c out of the loop, you'll see that angular cli is installed.

@AnalyzePlatypus
Copy link

Still getting this in March 2018:

FROM node:8.0
RUN npm install -g @angular/cli

This spins into an infinite loop when in gets to the gyp build part.
Using @PhilThurston's --unsafe option helped me.

Why is this still a problem?

@wisnuwew
Copy link

Same issue with Node v9.11.1 and NPM 5.6.0

@knicholes
Copy link

Tried installing this with the latest Node docker image. Received the loop because it didn't want to install as root. Use the node user, but I didn't have write permissions to where I wanted to install. Tried --unsafe with success.

@asottile
Copy link

npm_config_user=root npm install -g ...

works for me

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests