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

Has anyone used yarn package manager. Its fast, easy, understandable (meaningful). You can :

  1. Install yarn npm install yarn -g
  2. use yarn to install angular-cli yarn global add angular-cli.

Done thats its it worked for me.

Digender avatar Oct 26 '16 06:10 Digender

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.

rafalkasa avatar Oct 26 '16 07:10 rafalkasa

Sooo ng doesn't run. I am not having a fun time with the CLI

Aymons-MacBook-Air:MyProjects aymon$ npm install -g -f angular-cli
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 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]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: use uuid module instead
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/Users/aymon/.npm-packages/bin/ng -> /Users/aymon/.npm-packages/lib/node_modules/angular-cli/bin/ng
/Users/aymon/.npm-packages/lib
└── [email protected]

Aymons-MacBook-Air:MyProjects aymon$ ng
-bash: ng: command not found

EDIT: had to add alias ng="/Users/aymon/.npm-packages/lib/node_modules/angular-cli/bin/ng" to ~/.bash_profile and i can use the command now

invious avatar Dec 16 '16 18:12 invious

C:\Users\499705\Desktop\angular cli>npm install -g angular-cli@latest npm WARN deprecated [email protected]: 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

[email protected] install C:\Users\499705\AppData\Roaming\npm\node_modules\angul ar-cli\node_modules\node-sass node scripts/install.js

Cached binary found at C:\Users\499705\AppData\Roaming\npm-cache\node-sass\4.5.0 \win32-ia32-48_binding.node

[email protected] postinstall C:\Users\499705\AppData\Roaming\npm\node_modules\a ngular-cli\node_modules\node-sass node scripts/build.js

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. (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 [email protected] gyp info using [email protected] | 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 verb which failed at getNotFoundError (C:\Users\499705\AppData\Roaming \npm\node_modules\angular-cli\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:80:29) gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\which\which.js:89:16 gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\isexe\index.js:44:5 gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\isexe\windows.js:29:5 gyp verb which failed at FSReqWrap.oncomplete (fs.js:123:15) gyp verb which failed python2 { Error: not found: python2 gyp verb which failed at getNotFoundError (C:\Users\499705\AppData\Roaming \npm\node_modules\angular-cli\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:80:29) gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\which\which.js:89:16 gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\isexe\index.js:44:5 gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-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 verb which failed Error: not found: python gyp verb which failed at getNotFoundError (C:\Users\499705\AppData\Roaming \npm\node_modules\angular-cli\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:80:29) gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\which\which.js:89:16 gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\isexe\index.js:44:5 gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\isexe\windows.js:29:5 gyp verb which failed at FSReqWrap.oncomplete (fs.js:123:15) gyp verb which failed python { Error: not found: python gyp verb which failed at getNotFoundError (C:\Users\499705\AppData\Roaming \npm\node_modules\angular-cli\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Users\499705\AppData\Roaming\npm\node_modul es\angular-cli\node_modules\which\which.js:80:29) gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\which\which.js:89:16 gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-cli\node_modules\isexe\index.js:44:5 gyp verb which failed at C:\Users\499705\AppData\Roaming\npm\node_modules
angular-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. (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/[email protected] 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! [email protected] postinstall: node scripts/build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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

sankarprasad avatar Feb 08 '17 09:02 sankarprasad

screenshot from 2017-02-25 16-50-01

How can i solve this problem ?

DavidAbdelmalek avatar Feb 25 '17 20:02 DavidAbdelmalek

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":"win32","arch":"x64"}) npm WARN @angular/[email protected] requires a peer of rxjs@^5.0.1 but none was installed.

C:\Users\Admin\code\ang> C:\Users\Admin\code\ang>ng -v As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release, which will only support Node 6.9 and greater. This package will be officially deprecated shortly after.

To disable this warning use "ng set --global warnings.packageDeprecation=false".

Cannot find module 'C:\Users\Admin\code\ang\node_modules@angular\common\package.json' Error: Cannot find module 'C:\Users\Admin\code\ang\node_modules@angular\common\package.json' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Class.getVersion (C:\Users\Admin\AppData\Roaming\npm\node_modules\angular-cli\commands\version.js:70:25) at C:\Users\Admin\AppData\Roaming\npm\node_modules\angular-cli\commands\version.js:66:67 at Array.forEach (native) at Class.getDependencyVersions (C:\Users\Admin\AppData\Roaming\npm\node_modules\angular-cli\commands\version.js:66:14) at C:\Users\Admin\AppData\Roaming\npm\node_modules\angular-cli\commands\version.js:42:58 at Array.forEach (native) at Class.run (C:\Users\Admin\AppData\Roaming\npm\node_modules\angular-cli\commands\version.js:41:19) at Class. (C:\Users\Admin\AppData\Roaming\npm\node_modules\angular-cli\ember-cli\lib\models\command.js:134:17) at process._tickCallback (internal/process/next_tick.js:109:7)

C:\Users\Admin\code\ang>node -v v6.10.1

C:\Users\Admin\code\ang> someone please give me a suggestion to solve it

javakarthicklog avatar Mar 31 '17 11:03 javakarthicklog

Hi, I'm pretty new to angular, but just in case, to install angular-cli on ubuntu this worked for me:

  1. cd /usr/local/bin (which is my "npm bin -g" directory)
  2. sudo npm install -g angcli

Ubuntu 16.04LTS Node v4.2.6 NPM 3.5.2

steadyF0x avatar May 05 '17 00:05 steadyF0x

@jerry3105 works on osx too

simondoescode avatar Jun 16 '17 11:06 simondoescode

$ sudo npm i -g @angular/cli

then...

...
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.1.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.2' ]
gyp verb install input version string "8.1.2"
gyp verb install installing version: 8.1.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.2
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.1.2
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.1.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.2' ]
gyp verb install input version string "8.1.2"
gyp verb install installing version: 8.1.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.2
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.1.2
...

infinity loops to me

Diluka avatar Jul 04 '17 02:07 Diluka

Don't install npm packages with sudo, npm guide or use nvm

neilhem avatar Jul 05 '17 05:07 neilhem

npm install -g angular-cli@latest

appeared to install with this comment: npm WARN @angular/[email protected] requires a peer of rxjs@^5.0.1 but none was installed. new-host:~ walter$

cobwab avatar Jul 10 '17 19:07 cobwab

i tried all the solution still "ng" in not recognized. plz help

prashuMishra avatar Jul 18 '17 12:07 prashuMishra

I have done the npm install -g angular-cli and they show me the following error, how can i fix it to get started with developing for angular js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/@angular/cli/node_modules/chokidar/node_modules/fsevents):

and when i type ng help nothing happends they just show me that the program is not insatalled install ng-cammon,, thanks

wandieinnocents avatar Jul 28 '17 08:07 wandieinnocents

Remove ng file from usr/local/bin then uninstall sudo npm uninstall -g @angular/cli Reinstall sudo npm install -g @angular/cli

vishalanandl177 avatar Aug 09 '17 06:08 vishalanandl177

There is no ng file I'n that directory in my computer, On Aug 9, 2017 09:34, "Vishal Anand" [email protected] wrote:

Remove ng file from usr/local/bin then uninstall sudo npm uninstall -g @angular/cli Reinstall sudo npm install -g @angular/cli

— 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-321166297, or mute the thread https://github.com/notifications/unsubscribe-auth/APKzIvP-IgmyOLgNjat7pxxchc5JV3NJks5sWVMIgaJpZM4J-nHa .

wandieinnocents avatar Aug 09 '17 19:08 wandieinnocents

What OS are you using? If you are using Ubuntu, then it will work.

vishalanandl177 avatar Aug 09 '17 19:08 vishalanandl177

Using Ubuntu 16.04 ,ng file doesn't exist in that folder

wandieinnocents avatar Aug 09 '17 19:08 wandieinnocents

can any one help me!..is it recommended to install angular cli using "sudo" (sudo npm install angular-cli )? or without the key word "sudo"?

iddimsangi avatar Sep 29 '17 04:09 iddimsangi

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 Nodejs

neilhem avatar Sep 30 '17 10:09 neilhem

Thanks, @neilhem. Your advice of getting rid of sudo helps me. I've follow this article and after changing npm prefix, @angular/cli installs without problems.

SirWojtek avatar Oct 09 '17 00:10 SirWojtek