Can't install angular-cli globally
Please provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Mac OSX El Capitan
- Versions. Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
latest
- Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
npm install -g angular-cli or sudo npm install -g angular-cli or npm install -g angular-cli@latest
- The log given by the failure. Normally this include a stack trace and some more information.
canker:Angular CanKer$ sudo npm install -g angular-cli
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
/usr/local/bin/ng -> /usr/local/lib/node_modules/angular-cli/bin/ng
> [email protected] install /usr/local/lib/node_modules/angular-cli/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
sh: node-pre-gyp: command not found
npm WARN install:[email protected] [email protected] install: `node-pre-gyp install --fallback-to-build`
npm WARN install:[email protected] spawn ENOENT
> [email protected] install /usr/local/lib/node_modules/angular-cli/node_modules/execSync
> node install.js
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
sh: node: command not found
/usr/local/lib
`-- (empty)
npm WARN [email protected] requires a peer of [email protected] || 2.x.x but none was installed.
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "angular-cli"
npm ERR! node v6.6.0
npm ERR! npm v3.10.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the execSync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs execSync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls execSync
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/CanKer/Documents/Projekte/Angular/npm-debug.log
npm ERR! code 1
- Mention any other details that might be useful.
I'd installed not globally by error before and if I write npm view angular-cli version I see 1.0.0-beta.14 but I can't use the commands like ng new...
Thanks! We'll be in touch soon.
Ugh..same here. It did work with the old package name though: npm install -g -f angular-cli
@pstephenwille https://docs.npmjs.com/getting-started/fixing-npm-permissions use npm without sudo
I was having a problem with node version I updated from the terminal using install latest (9.2.0) The Angular/CLI do not suport it So I did sudo n 8.9.0 I installed again and sudo npm install -g -f @angular/cli And it worked!!
Hi,
A quick note to share that I uninstalled @angular/cli using:
sudo npm uninstall -g @angular/cli
Then, following option 2 in this article I created a hidden directory in my user directory
mkdir ~/.npm-global
edited ~/.profile to add ~/.npm-global/bin to $PATH
export PATH=~/.npm-global/bin:$PATH
and ran
source ~/.profile
After such steps I was able to install @angular/cli with
npm install -g @angular/cli
without any issues.
Thanks @neilhem
Mute it
Hi all, I had the same issue to install angular-cli and a little bit of Linux knowledge fixed my issue.
For some reason I don know, the /usr/local/lib/node_modules folder was the only one on 400 permission and owned by root.
solution was change the folder's owner
sudo chown -R ericluque:admin /usr/local/lib/node_modules
PS: I'm on Mac OSX High Sierra
Hi
Getting this Bellow Error while installing Angular.js in windows . Can you please help .
npm ERR! TypeError: Cannot read property 'latest' of undefined npm ERR! at next (D:\Govind\Projects\node_modules\npm\lib\cache.js:744:35) npm ERR! at D:\Govind\Projects\node_modules\npm\lib\cache.js:732:5 npm ERR! at saved (D:\Govind\Projects\node_modules\npm\node_modules\npm-registry-client\lib\get. js:148:7) npm ERR! at D:\Govind\Projects\node_modules\npm\node_modules\graceful-fs\polyfills.js:133:7 npm ERR! at Object.oncomplete (fs.js:107:15) npm ERR! If you need help, you may report this entire log, npm ERR! including the npm and node versions, at: npm ERR! http://github.com/npm/npm/issues
npm ERR! System Windows_NT 6.1.7601 npm ERR! command "D:\Govind\Projects\\node.exe" "D:\Govind\Projects\node_modules\npm\bin\n pm-cli.js" "install" "-g" "-f" "angular-cli" npm ERR! cwd D:\Govind\Projects npm ERR! node -v v0.10.26 npm ERR! npm -v 1.4.3 npm ERR! type non_object_property_load npm ERR! TypeError: Cannot read property 'latest' of undefined npm ERR! at next (D:\Govind\Projects\node_modules\npm\lib\cache.js:744:35) npm ERR! at D:\Govind\Projects\node_modules\npm\lib\cache.js:732:5 npm ERR! at saved (D:\Govind\Projects\node_modules\npm\node_modules\npm-registry-client\lib\get. js:148:7) npm ERR! at D:\Govind\Projects\node_modules\npm\node_modules\graceful-fs\polyfills.js:133:7 npm ERR! at Object.oncomplete (fs.js:107:15) npm ERR! If you need help, you may report this entire log, npm ERR! including the npm and node versions, at: npm ERR! http://github.com/npm/npm/issues
npm ERR! System Windows_NT 6.1.7601 npm ERR! command "D:\Govind\Projects\\node.exe" "D:\Govind\Projects\node_modules\npm\bin\n pm-cli.js" "install" "-g" "-f" "angular-cli" npm ERR! cwd D:\Govind\Projects npm ERR! node -v v0.10.26 npm ERR! npm -v 1.4.3 npm ERR! type non_object_property_load
hey try this
step1: npm uninstall -g @angular/cli
step2: npm cache clean
step3:npm install -g @angular/cli@latest
npm cache clean
On Tue, Dec 19, 2017 at 3:46 PM, govindareddy2011 [email protected] wrote:
Hi
Getting this Bellow Error while installing Angular.js . Can you please help .
npm ERR! TypeError: Cannot read property 'latest' of undefined npm ERR! at next (D:\Govind\Projects\node_modules\npm\lib\cache.js:744:35) npm ERR! at D:\Govind\Projects\node_modules\npm\lib\cache.js:732:5 npm ERR! at saved (D:\Govind\Projects\node_modules\npm\node_modules\npm- registry-client\lib\get. js:148:7) npm ERR! at D:\Govind\Projects\node_modules\npm\node_modules
graceful-fs\polyfills.js:133:7 npm ERR! at Object.oncomplete (fs.js:107:15) npm ERR! If you need help, you may report this entire log, npm ERR! including the npm and node versions, at: npm ERR! http://github.com/npm/npm/issues https://github.com/npm/npm/issuesnpm ERR! System Windows_NT 6.1.7601 npm ERR! command "D:\Govind\Projects\node.exe" "D:\Govind\Projects\node_ modules\npm\bin\n pm-cli.js" "install" "-g" "-f" "angular-cli" npm ERR! cwd D:\Govind\Projects npm ERR! node -v v0.10.26 npm ERR! npm -v 1.4.3 npm ERR! type non_object_property_load npm ERR! TypeError: Cannot read property 'latest' of undefined npm ERR! at next (D:\Govind\Projects\node_modules\npm\lib\cache.js:744:35) npm ERR! at D:\Govind\Projects\node_modules\npm\lib\cache.js:732:5 npm ERR! at saved (D:\Govind\Projects\node_modules\npm\node_modules\npm- registry-client\lib\get. js:148:7) npm ERR! at D:\Govind\Projects\node_modules\npm\node_modules
graceful-fs\polyfills.js:133:7 npm ERR! at Object.oncomplete (fs.js:107:15) npm ERR! If you need help, you may report this entire log, npm ERR! including the npm and node versions, at: npm ERR! http://github.com/npm/npm/issues https://github.com/npm/npm/issuesnpm ERR! System Windows_NT 6.1.7601 npm ERR! command "D:\Govind\Projects\node.exe" "D:\Govind\Projects\node_ modules\npm\bin\n pm-cli.js" "install" "-g" "-f" "angular-cli" npm ERR! cwd D:\Govind\Projects npm ERR! node -v v0.10.26 npm ERR! npm -v 1.4.3 npm ERR! type non_object_property_load
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/2161#issuecomment-352699481, or mute the thread https://github.com/notifications/unsubscribe-auth/AY8qabLYdNXSVrRVQfvf4qoGQTlD3RUSks5tB4z-gaJpZM4J-nHa .
Gave me the same error!! third time is installed correctly..
getting error while installing angular/cli in ubuntu 16.04. npm version -: 4.6.1 /root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/bin/ng
[email protected] install /root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/node_modules/node-sass node scripts/install.js
sh: 1: node: Permission denied
[email protected] postinstall /root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/node_modules/webpack/node_modules/uglifyjs-webpack-plugin node lib/post_install.js
sh: 1: node: Permission denied /root/.nvm/versions/node/v8.9.4/lib `-- (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/@angular/cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/@angular/cli/node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@angular/cli/node_modules/node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node scripts/install.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] postinstall: node lib/post_install.js
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-02-09T19_27_21_111Z-debug.log
I have faced and fixed this issue relates node-sass and python error.Try installing latest angular cli command with the steps below
Set the system variable path as well: C:\Users\windowsusername\AppData\Roaming\npm
C:\Users\windowsusername\AppData\Roaming\npm\node_modules@angular\cli\bin;
C:\Program Files\nodejs;
Then start using angular cli command prompt using: angular client project folder path>npm install -g @angular/cli@latest
angular client project folder path>npm install -g node-gyp
I have tried so many solutions but after all
:+1: This works for me
npm install -g -f angular-cli
-f - Forcefully we have to install with its dependencies
Just do the following steps:
-
sudo chmod 777 -R /usr/local/bin -
npm install -g -f @angular/cli
Getting similar error, could use a hand
7100 error path /usr/local/bin/ng 7101 error code EEXIST 7102 error Refusing to delete /usr/local/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /usr/local/bin 7103 error File exists: /usr/local/bin/ng 7104 error Move it away, and try again.
Manjaro Deepin
npm ERR! path /usr/lib/node_modules/.staging npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall mkdir npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/.staging' npm ERR! { [Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/.staging'] npm ERR! cause: npm ERR! { Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/.staging' npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'mkdir', npm ERR! path: '/usr/lib/node_modules/.staging' }, npm ERR! stack: npm ERR! 'Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/.staging'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'mkdir', npm ERR! path: '/usr/lib/node_modules/.staging', npm ERR! parent: 'webpack-sources' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in: npm ERR! /home/deyveson/.npm/_logs/2018-09-27T03_18_16_875Z-debug.log
Hi all, I had the same issue to install angular-cli and a little bit of Linux knowledge fixed my issue.
For some reason I don know, the /usr/local/lib/node_modules folder was the only one on 400 permission and owned by root.
solution was change the folder's owner
sudo chown -R ericluque:admin /usr/local/lib/node_modules
PS: I'm on Mac OSX High Sierra
Thanks eric! This worked for me (High Sierra, late 2018).
Hi,
A quick note to share that I uninstalled @angular/cli using:
sudo npm uninstall -g @angular/cliThen, following option 2 in this article I created a hidden directory in my user directory
mkdir ~/.npm-globaledited
~/.profileto add~/.npm-global/bin to $PATHexport PATH=~/.npm-global/bin:$PATHand ran
source ~/.profileAfter such steps I was able to install @angular/cli with
npm install -g @angular/cliwithout any issues.Thanks @neilhem
This worked for us. Missing npm config set prefix '~/.npm-global' step. Check the shared link thoroughly.
-f option didn't work
On MacOS Sierra, node 11 installed with brew. Everything here didn't work.
I succeed by doing
npm install npm@latest -g
sudo npm i @angular/cli -g -f
Hello friends. I have one issue that each time i type any ng command its ask for google chrome, notepad,etc . and when i hit on google chrome. Its shows like this

Please give me solution, i also downgrade node & angular as well :)
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.