Angular-cli: Angular/cli@latest installation taking too long and keep showing same chunk of message in iteration

Created on 8 Nov 2017  路  13Comments  路  Source: angular/angular-cli

Hi,

I am upgrading angular/cli, just before that I have uninstall/deleted existing node.js, npm, typescript and cli globally and locally. Reinstalled the latest node.js with npm and typescript.

Now I am installing cli with
sudo npm install -g @angular/cli@latest
on terminal and it's taking over 15 minutes (previous installation took 3 minutes), keep on showing the following message in iteration (pasted below) and heating up my laptop.

Is it normal?

Thanks.
Fuad

Machine Configuration:
Angular CLI: 1.5.0
Node: 8.9.1
Angular:
...
OS: darwin x64 Sierra 10.12.6

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

Most helpful comment

As suggested in the following post running with --unsafe-perm option makes this succeed.
https://github.com/nodejs/node-gyp/issues/454

sudo npm install --unsafe-perm -g @angular/cli

from npm help scripts

If npm was invoked with root privileges, then it will change the uid to the user account or uid specified by the user config, which defaults to nobody. Set the unsafe-perm flag to run scripts with root privileges.

All 13 comments

me too facing this issue since v1.5.0

This doesn't appear to be a CLI issue but rather a node/npm issue. However, it appears that there is a permissions issue. Generally sudo should not be necessary to install a global package.

The installation was on loop for over 45 minutes before I aborted it. Even though there are articles on the net about installations took a prolonged time, I'm sure that's not the case in here. My installation was hung on loop. @clydin It didn't let me install without the sudo prefix and I installed previous angular/cli versions without any permission problem. In the meantime, I'm installing the previous versions to get going before this is fixed.

As suggested in the following post running with --unsafe-perm option makes this succeed.
https://github.com/nodejs/node-gyp/issues/454

sudo npm install --unsafe-perm -g @angular/cli

from npm help scripts

If npm was invoked with root privileges, then it will change the uid to the user account or uid specified by the user config, which defaults to nobody. Set the unsafe-perm flag to run scripts with root privileges.

Same issue and sudo chown -R $(whoami) /usr/local/lib/node_modules fixed it on my machine.
reference

This repo is not the correct forum to debug general npm installation issues (even if they are related to installing the CLI itself). Please consult npm documentation and forums.

Yes it is indeed an npm issue, precisely a computer user permission issue. Help from the official npm site fixed my problem. Link is given below. Enjoy!
https://docs.npmjs.com/getting-started/fixing-npm-permissions
can also sneak a peek at:
https://www.youtube.com/watch?v=dBuLKZpmHDI

Confirmed, I had to do the following on Fedora 27

sudo chown -R root:root /usr/lib/node_modules

as for whatever reason /usr/lib/node_modules/npm was owned by myself instead of root...

i am using ubuntu and i tried install @angular/cli with yarn . but after installation output is :
The program 'ng' is currently not installed. You can install it by typing: sudo apt install ng-common

I had the same issue but it worked well when I download angular-cli through homebrew.

brew install angular-cli

I was facing this error while running yarn install. While searching into the @angular/cli package.json file, I found it has node-sass as an optionalDependency.

So running yarn install --ignore-optional solved my issue (given that I already have node-sass in my project's devDependencies.

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._

Was this page helpful?
0 / 5 - 0 ratings