x)- [X] bug report -> please search issues before submitting
- [ ] feature request
$ ng -v; node -v; npm -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ â–³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.1.2
node: 8.1.2
os: linux x64
v8.1.2
5.0.3
sudo apt-get install -y nodejssudo npm install -g @angular/cli
@angular/cli refuses to install, saying root user is not allowed to write into /usr/lib/node_modules/....
The install process retries endlessly.
@angular/cli to check if node-gyp is installed an either fail saying requirement missing or install it by itself
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
@rotemfogel you should not be installing npm packages using sudo. https://docs.npmjs.com/getting-started/fixing-npm-permissions
@nikoTM this is not a question whether "you should' or "you should not'... the default node/npm installation forces sudo usage under Ubuntu.
BTW: does your suggestion solve the issue?
Confirm, the sudo npm install -g @angular/cli produces an infinite installation loop under Ubuntu with default access permissions under /usr/lib/node_modules.
Same issue over here
I'm having the same issue as @UniK .
I have the same issue on Ubuntu 16.04 and installing the gyn before did not fix the problem
gyp verb install version not already installed, continuing with install 8.7.0
gyp verb ensuring nodedir is created /usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.7.0
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.7.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/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.7.0' ]
gyp verb install input version string "8.7.0"
gyp verb install installing version: 8.7.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.7.0
gyp verb ensuring nodedir is created /usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.7.0
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.7.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/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.7.0' ]
gyp verb install input version string "8.7.0"
gyp verb install installing version: 8.7.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.7.0
gyp verb ensuring nodedir is created /usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.7.0
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.7.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb^C
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
more information
node -v
v8.7.0
npm -v
5.4.2
Experiencing the same issue and like @devsparkles found that cancelling the angular/cli install once it hits its infinite loop and re-running the same command fixes the issue.
In my case, I was running this as a gitlab build job and not interactively so I had to script this. If anyone else is this unfortunate position while waiting for the issue to be resolve... the script snippet is below (it sure is ugly but it may get you out of a hole!)
npm install -g node-gyp
timeout 120 npm install -g @angular/cli > /dev/null
npm install -g @angular/cli
the timeout line is the script equivalent of letting it partially install and then ctrl+C when it gets in its nasty loop state.
Repo steps:
docker run -it node:latest /bin/bash
Note: by default you will be running as root which may be part of the issue
npm install -g @angular/cli
node -v
v8.5.0
npm -v
5.3.0
formatted script
npm install -g node-gyp
timeout 120 npm install -g @angular/cli > /dev/null
npm install -g @angular/cli
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
having the same issue on Mac OS high sierra.
npm: 5.5.1
node:8.9.1
following the steps listed here resolved the issue.
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...
Spent lot of time on this issue, even I had the same issue, tried everything suggested over here, clear npm cache as well, please read the bl0g below to install nvm
https://github.com/creationix/nvm/blob/master/README.md#installation
Even this helped a lot,
Once you install nvm enter nvm use node in terminal
and then use sudo npm install -g @angular/cli
i faced same issue .any update to solve this ?
Install NVM (node version manager), then install angular it solves this issue..
i installed it . actually that's where everything is messed up . before i created new components with ng .
but then after installation of nvm .it got messed everything
now i was able to use ng commands . i just removed node,npm and nvm .everything is running well now .
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.
Still getting an infinite loop while installing @angular/cli on 64bit Ubuntu 16.04. Problem solved by installing node-gyp first.
thanks to @xvalerijus , that command solved my problem.
But how to clean up the mess, which takes lots of my disk space. And "npm cache clean" does not work!
In Ubuntu 18.04 You have to follow some steps
On the command line, in your home directory, create a directory for global installations:
step 1 mkdir ~/.npm-global
Configure npm to use the new directory path:
step 2 npm config set prefix '~/.npm-global'
In your preferred text editor, open or create a ~/.profile file and add this line:
step 3 export PATH=~/.npm-global/bin:$PATH
On the command line, update your system variables:
step 4 source ~/.profile
To test your new configuration, install a package globally without using sudo
step 5 npm install -g jshint
I hope it will help you also
The CLI has been updated significantly since version 1.1.2. The current stable version is 8.3.5. If this problem is still being encountered with the current version, please consider opening a new issue with updated details.
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._
Most helpful comment
Confirm, the
sudo npm install -g @angular/cliproduces an infinite installation loop under Ubuntu with default access permissions under/usr/lib/node_modules.