angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Can't install angular-cli globally

Open CanKer opened this issue 10 years ago • 60 comments

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Mac OSX El Capitan

  1. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

latest

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

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

CanKer avatar Sep 16 '16 05:09 CanKer

Ugh..same here. It did work with the old package name though: npm install -g -f angular-cli

pstephenwille avatar Nov 03 '17 23:11 pstephenwille

@pstephenwille https://docs.npmjs.com/getting-started/fixing-npm-permissions use npm without sudo

Diluka avatar Nov 04 '17 10:11 Diluka

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!!

gmbarroso avatar Nov 18 '17 18:11 gmbarroso

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

steadyF0x avatar Nov 22 '17 23:11 steadyF0x

Mute it

Survivedabuse73 avatar Dec 02 '17 06:12 Survivedabuse73

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

ericluque avatar Dec 12 '17 20:12 ericluque

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

govindareddy2011 avatar Dec 19 '17 10:12 govindareddy2011

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/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 https://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

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

javakarthicklog avatar Jan 03 '18 14:01 javakarthicklog

Gave me the same error!! third time is installed correctly..

jokercimi avatar Jan 06 '18 21:01 jokercimi

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

ridhansh avatar Feb 09 '18 19:02 ridhansh

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

SatishMHiremath avatar Feb 17 '18 22:02 SatishMHiremath

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

Chavadabhavin avatar Jun 20 '18 10:06 Chavadabhavin

Just do the following steps:

  • sudo chmod 777 -R /usr/local/bin

  • npm install -g -f @angular/cli

MirzaBaig715 avatar Jul 19 '18 08:07 MirzaBaig715

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.

scarlough avatar Aug 03 '18 18:08 scarlough

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

Deyveson avatar Sep 27 '18 03:09 Deyveson

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

PeerRoth avatar Dec 11 '18 05:12 PeerRoth

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

This worked for us. Missing npm config set prefix '~/.npm-global' step. Check the shared link thoroughly.

-f option didn't work

meetai avatar Jan 09 '19 04:01 meetai

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

dfa1234 avatar Jan 15 '19 06:01 dfa1234

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 54114861_1429849197157493_7407517335063363584_o 54419852_1429849230490823_7434053081832095744_o

Please give me solution, i also downgrade node & angular as well :)

akshaybhagwat76 avatar Mar 22 '19 03:03 akshaybhagwat76

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.