angular-cli: 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 --version
and 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 graceful-fs@1.2.3: 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 minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash-node@2.4.1: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
/usr/local/bin/ng -> /usr/local/lib/node_modules/angular-cli/bin/ng
> fsevents@1.0.14 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:fsevents@1.0.14 fsevents@1.0.14 install: `node-pre-gyp install --fallback-to-build`
npm WARN install:fsevents@1.0.14 spawn ENOENT
> execSync@1.0.2 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 string-replace-loader@1.0.3 requires a peer of webpack@1.x.x || 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! execSync@1.0.2 install: `node install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the execSync@1.0.2 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.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 61 (4 by maintainers)
npm install -g -f angular-cli
@karthikkavinTry to clean cache
npm cache clean
, uninstall angular-clinpm uninstall -g angular-cli
& install againnpm install -g angular-cli
@neilhem The following worked for me npm cache clean npm uninstall -g angular-cli npm install -g -f angular-cli ng --help
Thats it.
Hello I just installed with
-f
or--force
flag and it worked. I should close this and thank you all for your time. 😃Has anyone used yarn package manager. Its fast, easy, understandable (meaningful). You can :
npm install yarn -g
yarn global add angular-cli.
Done thats its it worked for me.
+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.angular-cli
, likesudo npm uninstall -g angular-cli
angular-cli
repo,angular-cli
repo folder, and runnpm link
,npm link angular-cli
ng
command, I use./node_modules/angular-cli/bin/ng
from my project folderSorry @neilhem that doesn’t work. 😦
Hi, I’m pretty new to angular, but just in case, to install angular-cli on ubuntu this worked for me:
cd /usr/local/bin
(which is my “npm bin -g” directory)sudo npm install -g angcli
Ubuntu 16.04LTS Node v4.2.6 NPM 3.5.2
I have tried so many solutions but after all
👍 This works for me
npm install -g -f angular-cli
-f - Forcefully we have to install with its dependencies
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
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.
Thanks @CanKer
Just do the following steps:
sudo chmod 777 -R /usr/local/bin
npm install -g -f @angular/cli
Mute it
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
sudo
is a bad idea. I assume in some systems node requires root access to install local or global node packages by default. Consider this article or install node via nvm, version for windows or version for linux and macOS. Also you can use package managers like Homebrew, Scoop or Chocolatey to install NodejsC:\Users\499705\Desktop\angular cli>npm install -g angular-cli@latest npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue C:\Users\499705\AppData\Roaming\npm\ng -> C:\Users\499705\AppData\Roaming\npm\no de_modules\angular-cli\bin\ng
Cached binary found at C:\Users\499705\AppData\Roaming\npm-cache\node-sass\4.5.0 \win32-ia32-48_binding.node
Binary found at C:\Users\499705\AppData\Roaming\npm\node_modules\angular-cli\nod e_modules\node-sass\vendor\win32-ia32-48\binding.node Testing binary Binary has a problem: Error: %1 is not a valid Win32 application. \?\C:\Users\499705\AppData\Roaming\npm\node_modules\angular-cli\node_modules\no de-sass\vendor\win32-ia32-48\binding.node at Error (native) at Object.Module._extensions…node (module.js:597:18) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at module.exports (C:\Users\499705\AppData\Roaming\npm\node_modules\angular- cli\node_modules\node-sass\lib\binding.js:19:10) at Object.<anonymous> (C:\Users\499705\AppData\Roaming\npm\node_modules\angu lar-cli\node_modules\node-sass\lib\index.js:14:35) at Module._compile (module.js:570:32) Building the binary locally Building: C:\Program Files\nodejs\node.exe C:\Users\499705\AppData\Roaming\npm\n ode_modules\angular-cli\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose –libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info it worked if it ends with ok gyp verb cli [ ‘C:\Program Files\nodejs\node.exe’, gyp verb cli ‘C:\Users\499705\AppData\Roaming\npm\node_modules\angular- cli\node_modules\node-gyp\bin\node-gyp.js’, gyp verb cli ‘rebuild’, gyp verb cli ‘–verbose’, gyp verb cli ‘–libsass_ext=’, gyp verb cli ‘–libsass_cflags=’, gyp verb cli ‘–libsass_ldflags=’, gyp verb cli ‘–libsass_library=’ ] gyp info using node-gyp@3.5.0 gyp info using node@6.9.4 | win32 | ia32 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing “build” directory gyp verb command configure [] gyp verb check python checking for Python executable “python2” in the PATH gyp verb
which
failed Error: not found: python2 gyp verbwhich
failed at getNotFoundError (C:\Users\499705\AppData\Roaming \npm\node_modules\angular-cli\node_modules\which\which.js:13:12) gyp verbwhich
failed at F (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:68:19) gyp verbwhich
failed at E (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:80:29) gyp verbwhich
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\which\which.js:89:16 gyp verb
which
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\isexe\index.js:44:5 gyp verb
which
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\isexe\windows.js:29:5 gyp verb
which
failed at FSReqWrap.oncomplete (fs.js:123:15) gyp verbwhich
failed python2 { Error: not found: python2 gyp verbwhich
failed at getNotFoundError (C:\Users\499705\AppData\Roaming \npm\node_modules\angular-cli\node_modules\which\which.js:13:12) gyp verbwhich
failed at F (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:68:19) gyp verbwhich
failed at E (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:80:29) gyp verbwhich
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\which\which.js:89:16 gyp verb
which
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\isexe\index.js:44:5 gyp verb
which
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\isexe\windows.js:29:5 gyp verb
which
failed at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOENT ’ } gyp verb check python checking for Python executable “python” in the PATH gyp verbwhich
failed Error: not found: python gyp verbwhich
failed at getNotFoundError (C:\Users\499705\AppData\Roaming \npm\node_modules\angular-cli\node_modules\which\which.js:13:12) gyp verbwhich
failed at F (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:68:19) gyp verbwhich
failed at E (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:80:29) gyp verbwhich
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\which\which.js:89:16 gyp verb
which
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\isexe\index.js:44:5 gyp verb
which
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\isexe\windows.js:29:5 gyp verb
which
failed at FSReqWrap.oncomplete (fs.js:123:15) gyp verbwhich
failed python { Error: not found: python gyp verbwhich
failed at getNotFoundError (C:\Users\499705\AppData\Roaming \npm\node_modules\angular-cli\node_modules\which\which.js:13:12) gyp verbwhich
failed at F (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:68:19) gyp verbwhich
failed at E (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:80:29) gyp verbwhich
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\which\which.js:89:16 gyp verb
which
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\isexe\index.js:44:5 gyp verb
which
failed at C:\Users\499705\AppData\Roaming\npm\node_modulesangular-cli\node_modules\isexe\windows.js:29:5 gyp verb
which
failed at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOENT ’ } gyp verb could not find “python”. checking python launcher gyp verb could not find “python”. guessing location gyp verb ensuring that file exists: C:\Python27\python.exe gyp ERR! configure error gyp ERR! stack Error: Can’t find Python executable “python”, you can set the PYT HON env variable. gyp ERR! stack at Object.failNoPython (C:\Users\499705\AppData\Roaming\npm\n ode_modules\angular-cli\node_modules\node-gyp\lib\configure.js:454:19) gyp ERR! stack at Object.<anonymous> (C:\Users\499705\AppData\Roaming\npm\no de_modules\angular-cli\node_modules\node-gyp\lib\configure.js:480:16) gyp ERR! stack at C:\Users\499705\AppData\Roaming\npm\node_modules\angular-c li\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Users\499705\AppDa ta\Roaming\npm\node_modules\angular-cli\node_modules\node-gyp\bin\node-g yp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldf lags=” “–libsass_library=” gyp ERR! cwd C:\Users\499705\AppData\Roaming\npm\node_modules\angular-cli\node_m odules\node-sass gyp ERR! node -v v6.9.4 gyp ERR! node-gyp -v v3.5.0 gyp ERR! not ok Build failed with error code: 1 C:\Users\499705\AppData\Roaming\npm `-- (empty)npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\an gular-cli\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 1.0.17: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:"ia32 "}) npm WARN @angular/core@2.4.6 requires a peer of rxjs@^5.0.1 but none was install ed. npm ERR! Windows_NT 6.1.7601 npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Users\499705\AppData
\Roaming\npm\node_modules\npm\bin\npm-cli.js” “install” “-g” “angular-cli@l atest” npm ERR! node v6.9.4 npm ERR! npm v4.1.1 npm ERR! code ELIFECYCLE
npm ERR! node-sass@4.5.0 postinstall:
node scripts/build.js
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@4.5.0 postinstall script 'node scripts/build.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 node-sass package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node scripts/build.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs node-sass npm ERR! Or if that isn’t available, you can get their info via: npm ERR! npm owner ls node-sass npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! C:\Users\499705\Desktop\angular cli\npm-debug.log
In my case problem was related to this issue with ui.micro https://github.com/Microsoft/vscode/issues/13559 disable McAfee fix the problem.
Please try this before you will start installing angular-cli on your machine:
npm install -g uc.micro
Maybe it will help someone else.