angular-cli: cli won't install on ubuntu 16.04 without installing node-gyp manually
Bug Report or Feature Request (mark with an x
)
- [X] bug report -> please search issues before submitting
- [ ] feature request
Versions.
$ ng -v; node -v; npm -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.1.2
node: 8.1.2
os: linux x64
v8.1.2
5.0.3
Repro steps.
- install ubuntu 16.04
- install nodejs (using apt)
sudo apt-get install -y nodejs
- install @angular/cli
sudo npm install -g @angular/cli
The log given by the failure.
@angular/cli refuses to install, saying root user is not allowed to write into /usr/lib/node_modules/… The install process retries endlessly.
Desired functionality.
@angular/cli to check if node-gyp is installed an either fail saying requirement missing or install it by itself
Mention any other details that might be useful.
A fix for the issue, is manually installing node-gyp prior to installing @angular/cli
$ sudo npm install -g node-gyp
$ sudo npm install -g @angular/cli
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 41
- Comments: 23 (1 by maintainers)
Confirm, the
sudo npm install -g @angular/cli
produces an infinite installation loop under Ubuntu with default access permissions under/usr/lib/node_modules
.On my Ubuntu it worked fine by first installing node-gyp. On another machine with Debian8 all solutions listed here failed, the only one which worked in this case was
sudo npm install --unsafe-perm -g @angular/cli
I did that: $ sudo rm -Rf @angular/ node-gyp $ sudo npm install -g node-gyp /usr/bin/node-gyp -> /usr/lib/node_modules/node-gyp/bin/node-gyp.js
node-gyp@3.6.2 added 102 packages in 2.298s Then open a new terminal and sudo npm install -g @angular/cli Got AGAIN the LOOP Mayhem problem the retry and got a success… sudo npm install -g @angular/cli /usr/bin/ng -> /usr/lib/node_modules/@angular/cli/bin/ng npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/@angular/cli/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
@angular/cli@1.4.9 updated 2 packages in 50.573s
more information node -v v8.7.0 npm -v 5.4.2
now i was able to use
ng
commands . i just removednode
,npm
andnvm
.everything is running well now .@rotemfogel you should not be installing npm packages using sudo. https://docs.npmjs.com/getting-started/fixing-npm-permissions
Had similar infinite loop while installing @angular/cli in docker environment (using FROM node:8.11.1 ). The only solution that worked for me was using the --unsafe-perm switch while installing angular cli.
Same issue on ubuntu 17.04. Installing @angular/cli through npm makes it go into an infinite loop giving an EACCESS error saying user “root” doesn’t have enough permissions to access the dev dir “/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.9.1” and then it tries reinstalling from the temporary dev directory and this goes on forever…