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

Try to clean cache npm cache clean, uninstall angular-cli npm uninstall -g angular-cli & install again npm install -g angular-cli

neilhem avatar Sep 16 '16 06:09 neilhem

Sorry @neilhem that doesn't work. :(

CanKer avatar Sep 16 '16 06:09 CanKer

+1. This doesn't work for me in Ubuntu 14.04 as well. Somehow ng serve still serves with old version (by checking the webpack its running). To get my app working temporarily, I do.

  • Clean uninstall of angular-cli, like sudo npm uninstall -g angular-cli
  • Clone this angular-cli repo,
  • Go to the angular-cli repo folder, and run npm link,
  • Go to my project folder
  • Run npm link angular-cli
  • Now to run ng command, I use ./node_modules/angular-cli/bin/ng from my project folder

chozzz avatar Sep 16 '16 06:09 chozzz

Hello I just installed with -f or --force flag and it worked. I should close this and thank you all for your time. :)

CanKer avatar Sep 16 '16 06:09 CanKer

@CanKer Hello How where to use -force flag?

karthikkavin avatar Sep 16 '16 06:09 karthikkavin

npm install -g -f angular-cli @karthikkavin

CanKer avatar Sep 16 '16 06:09 CanKer

Thanks @CanKer

karthikkavin avatar Sep 16 '16 06:09 karthikkavin

For me npm install -g -f angular-cli gives below error message could you please suggest fix for this.

npm WARN using --force I sure hope you know what you are doing. npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will n node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as p . Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or to avoid a RegExp DoS issue npm WARN deprecated [email protected]: This package is discontinued. Use ^4.0.0. npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\shekharsu pData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" " gular-cli" npm ERR! node v4.5.0 npm ERR! npm v3.10.6 npm ERR! path C:\Users\SHEKHA~1\AppData\Local\Temp\npm-9268-e64aa74b\regi mjs.org\uc.micro npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall mkdir

npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Users\SHEKHA~1
\Local\Temp\npm-9268-e64aa74b\registry.npmjs.org\uc.micro' npm ERR! at Error (native) npm ERR! { [Error: EPERM: operation not permitted, mkdir 'C:\Users\SHEKH Data\Local\Temp\npm-9268-e64aa74b\registry.npmjs.org\uc.micro'] npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'mkdir', npm ERR! path: 'C:\Users\SHEKHA~1\AppData\Local\Temp\npm-9268-e64 registry.npmjs.org\uc.micro', npm ERR! parent: 'markdown-it' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request: npm ERR! D:\angular\npm-debug.log

shekhar90 avatar Oct 12 '16 12:10 shekhar90

@shekhar90 have you tried solution in this comment

neilhem avatar Oct 13 '16 04:10 neilhem

yes... its not working for me

shekhar90 avatar Oct 13 '16 08:10 shekhar90

@neilhem The following worked for me npm cache clean npm uninstall -g angular-cli npm install -g -f angular-cli ng --help

Thats it.

Digender avatar Oct 16 '16 08:10 Digender

npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed. npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed. npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed. npm ERR! Darwin 15.6.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "angular-cli" npm ERR! node v6.8.1 npm ERR! npm v3.10.8 npm ERR! path /lib npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/lib' npm ERR! at Error (native) npm ERR! { Error: EACCES: permission denied, access '/lib' npm ERR! at Error (native) errno: -13, code: 'EACCES', syscall: 'access', path: '/lib' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request: npm ERR! /Users/deedaralam/npm-debug.log

Kindly solve this issue

deedaralam avatar Oct 17 '16 12:10 deedaralam

Find the location of nodejs via where is nodejs then do,

ln -s /usr/bin/nodejs ~/bin/node (yes, no sudo there); replace /usr/bin/nodejs with the path your nodejs is at.

RamachandraSahG avatar Oct 18 '16 09:10 RamachandraSahG

i have try now can you share your screenshots

deedaralam avatar Oct 18 '16 10:10 deedaralam

screenshot from 2016-10-18 15-52-28

RamachandraSahG avatar Oct 18 '16 10:10 RamachandraSahG

screen shot 2016-10-18 at 3 29 19 pm

deedaralam avatar Oct 18 '16 10:10 deedaralam

kindly tell me step by step

deedaralam avatar Oct 18 '16 10:10 deedaralam

This looks like you are having some other locking problem with your Mac Os.

Please check below link for your problem. http://apple.stackexchange.com/questions/101328/file-cant-be-moved-by-root-on-os-x

RamachandraSahG avatar Oct 18 '16 10:10 RamachandraSahG

hi all i am getting this error while running the command ng new app1 image

vivekangadi1 avatar Oct 24 '16 16:10 vivekangadi1

i am getting this error while running ng serve...it is giving hot webpack dev server problem..any help me pls image

vivekangadi1 avatar Oct 24 '16 16:10 vivekangadi1