问题
Using the command prompt, I am trying to install angular CLI and it fails. I have npm version 5.5.1 and node version v8.9.1. I am trying to install angular cli using the command
npm install -g @angular/cli@latest
and it fails with the 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:
I look at the log file and I see its trying to fetch the package from a location that doesn't exist. Not sure from where it gets pulled. How do I fix this location path and install angular cli. Same happens when I try to install typescript or any other npm package. all of them try to install from the location mentioned below and it fails with 404
8 http fetch GET 404
http://nuget.feed.xyz.corp:8729/npm/FeedNPM/@angular%2fcli 109ms
9 silly fetchPackageMetaData error for @angular/cli@latest 404 Not Found:
@angular/cli@latest
10 verbose stack Error: 404 Not Found: @angular/cli@latest
回答1:
npm config set registry http://registry.npmjs.org
NPM registry documentation
回答2:
Alternative, another option to avoid 404 npm error
check if your terminal is in the root directory, if not your npm scripts will not execute because it will not be able to see the package.json
回答3:
in my case it was .npmrc
file in my project dir, which kept overwriting my global registry url. As soon as I deleted it, I could finally use npm install
回答4:
I had same problem with a private package. Need to:
- npm adduser
- npm login
回答5:
It was giving the same error for me when I use office network/vpn as they have 'umbrella' DNS security shield. To solve this issue, connect to personal network and type the below commands:
npm config set registry http://registry.npmjs.org
npm install -g @angular/cli
回答6:
- change your access level to public. type this in the terminal
npm --access=public
- install your angular.
sudo npm install @ngular/cli
来源:https://stackoverflow.com/questions/47520181/installing-npm-package-fails-with-404