Unable to install @angular/cli globally
On running sudo npm install -g @angular/cli I get the following error:
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/9.9.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
Adding a -f flag also gives the same result.
It works when I remove the -g flag, but I can install other packages with the -g flag. The following command works:
sudo npm install -g vanillajs
I've tried uninstalling npm and nodejs completely and then re-installing.
nodejs --version
v9.9.0
npm --version
5.6.0
lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
@ish-101 Did you find the solution? I met the same errors when install angular/cli on Mac. Could you help?
$ node -v
v8.11.1
$ npm -v
5.6.0
@huayuanzzb I found a pre-existing issue on this repository, and one of the solutions there worked for me: https://github.com/angular/angular-cli/issues/9676#issuecomment-366542449 This should hopefully work out for you too.
@ish-101 It works, thanks
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.