Angular-cli: Can't install angular-cli

Created on 15 Jan 2018  路  14Comments  路  Source: angular/angular-cli

This might sound very trivial, but I am hitting my head against the wall while I am trying (unsuccessfully) install angular-cli.

I am following the official angular-cli documentation here: https://www.npmjs.com/package/angular-cli/tutorial

mkotsollariss-MacBook-Pro:~ mkotsollaris$ npm -v
5.6.0
mkotsollariss-MacBook-Pro:~ mkotsollaris$ node -v
v8.9.4
mkotsollariss-MacBook-Pro:~ mkotsollaris$ 

Then I run npm install -g angular-cli which gives me:

mkotsollariss-MacBook-Pro:~ mkotsollaris$ npm install -g angular-cli
npm WARN deprecated [email protected]: angular-cli has been renamed to @angular/cli. Please update your dependencies.
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN @angular/[email protected] requires a peer of rxjs@^5.0.1 but none is installed. You must install peer dependencies yourself.
npm ERR! path /Users/mkotsollaris/.npm-packages/lib/node_modules/.staging/@angular
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rmdir
npm ERR! Error: EACCES: permission denied, rmdir '/Users/mkotsollaris/.npm-packages/lib/node_modules/.staging/@angular'
npm ERR!  { Error: EACCES: permission denied, rmdir '/Users/mkotsollaris/.npm-packages/lib/node_modules/.staging/@angular'
npm ERR!   stack: 'Error: EACCES: permission denied, rmdir \'/Users/mkotsollaris/.npm-packages/lib/node_modules/.staging/@angular\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rmdir',
npm ERR!   path: '/Users/mkotsollaris/.npm-packages/lib/node_modules/.staging/@angular' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mkotsollaris/.npm/_logs/2018-01-14T23_11_22_610Z-debug.log
mkotsollariss-MacBook-Pro:~ mkotsollaris$ ng
-bash: ng: command not found

I think I have tried almost everything on the web, and still can't make this to work.

My OS is MacOS High Sierra 10.13.2 .

Any idea what am I missing here?

Most helpful comment

Managed to install angular-cli through nvm:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
export NVM_DIR="/Users/mkotsollaris/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm --version
0.33.0
nvm install stable
nvm install node
npm install -g @angular/cli
ng new my-project
cd my-project
ng serve

See this SO post for more info.

Cheers!

All 14 comments

Current installation instructions are here: https://github.com/angular/angular-cli
I think this is the command you're looking for...

npm install -g @angular/cli

Are you sure about the @?
When installing with the @ prefix I get the following error.

npm ERR! code E404
npm ERR! 404 Not Found: @angular/cli@latest

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\vkmi\AppData\Roaming\npm-cache\_logs\2018-01-15T09_41_21_161Z-debug.log

Windows, Npm 5.6, Node 8.9.4

Meanwhile just install -g angular/cli seems to work, at least until the step where I get a whole other error related to git and ssh-ing in the repository.

When I try install -g angular/cli on my Mac, I get the following:

mkotsolarissMBP:~ mkotsollaris$ npm install -g angular/cli
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t ssh://[email protected]/angular/cli.git
npm ERR! 
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mkotsollaris/.npm/_logs/2018-01-15T14_46_09_856Z-debug.log
mkotsolarissMBP:~ mkotsollaris$ sudo npm install -g angular/cli
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t ssh://[email protected]/angular/cli.git
npm ERR! 
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mkotsollaris/.npm/_logs/2018-01-15T14_46_17_339Z-debug.log

The @ is correct. It designates a scoped package in npm. Scoping allows publishers to group packages in namespaces within npm. More info here: https://docs.npmjs.com/getting-started/scoped-packages

It could be that you are behind a proxy server or provider that is not passing through the '@' and/or the '/'.

Try escaping both of these characters with a backslash like this:

npm install -g \@angular\/cli

If that fails, please again try the original command:
npm install -g @angular/cli
and copy to this issue stream the associated log file you find at:
C:\Users\vkmi\AppData\Roaming\npm-cache\_logs\...

This seems to be a support issue and not an actual issue with the CLI, so I am closing this issue.

That being said the correct package name is @angular/cli

@vkmi , regardless of whether this is a closed CLI issue, please let me know if you were able to get beyond the problem, or if I can be of further assistance.

Thank you for your concern.
Sadly no amount of character escaping worked.

  • Escaping the @ in powershell was interpreted as indicating a path
  • Escaping the / searches for @angular**cli locally

Trying to bypass eventual proxy/provider problems by using my phone as an hotspot also gave no results.

I get
http fetch GET 404 https://registry.npmjs.org/@angular%2fcli
While navigating to the same link in a browser returns the correct json.
I don't know what part of my system is "broken".

In the end I set up a clean remote vm for this project, everything went right the first time and I called it a day.

Finally fixed, almost by chance.
What fixed it was logging out of the npm account I was using. I'm not sure why, though.
Maybe it had something to do with some configurations left behind by Verdaccio even after I uninstalled it.

Posting in case it may eventually help anyone who is having my same issue and feeling as much as a moron as I felt those last few days.

hi @vkmi I'm curious about your verdaccio configuration. Scope packages are fully supported. btw I'm verdaccio maintainer.

Hi @juanpicado, I'm sorry, since I already had uninstalled Verdaccio I also deleted the relative folder in my appdata folder, and I don't remember what my configuration was.
I had also tried Sinopia before Verdaccio, so it may have been caused by that instead.

@vkmi that might explain your issue, the last version [email protected] does not have support for scopes by default. If you have further questions about verdaccio feel free to ask in our forum.

Managed to install angular-cli through nvm:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
export NVM_DIR="/Users/mkotsollaris/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm --version
0.33.0
nvm install stable
nvm install node
npm install -g @angular/cli
ng new my-project
cd my-project
ng serve

See this SO post for more info.

Cheers!

I am having the issue of EACCES

Routerconfig:npm-global Sagar$ npm install -g @angular/cli
npm WARN checkPermissions Missing write access to /Users/Sagar/npm-global/lib/node_modules/@angular
npm ERR! path /Users/Sagar/npm-global/lib/node_modules/@angular
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/Sagar/npm-global/lib/node_modules/@angular'
npm ERR! { Error: EACCES: permission denied, access '/Users/Sagar/npm-global/lib/node_modules/@angular'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/Users/Sagar/npm-global/lib/node_modules/@angular\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/Sagar/npm-global/lib/node_modules/@angular' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Sagar/.npm/_logs/2018-06-17T15_10_17_569Z-debug.log

how to fix it please do reply

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

Was this page helpful?
0 / 5 - 0 ratings