Installing npm package fails with 404
node.jsAngular CliNpm Installnode.js Problem Overview
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
node.js Solutions
Solution 1 - node.js
npm config set registry http://registry.npmjs.org
Solution 2 - node.js
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
Solution 3 - node.js
Try first this commands (in windows run as administrator)
npm config set registry http://registry.npmjs.org
npm install -g @angular/cli
if still not working let's update NPM and nodejs by running this commands
npm -g install npm
npm cache clean -f
npm install -g n
then try to run
npm install -g @angular/cli
This should solve this problem
Solution 4 - node.js
Add a .npmrc
file in the root of the project. .npmrc
will look like below -
> @xy:registry=https://xyz.jfrog.io/xyz/api/npm/npm-local/ > @xy-app:registry=https://xyz.jfrog.io/xyz/api/npm/npm-local/
And Delete all the field eg - email , auth etc. Find out what is the registry url of your application and put it into the registry.
Then run command - npm install
And it will work.
Solution 5 - node.js
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
Solution 6 - node.js
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
Solution 7 - node.js
I had same problem with a private package. Need to:
npm adduser
npm login
Solution 8 - node.js
- change your access level to public. type this in the terminal
npm --access=public
- install your angular.
sudo npm install @ngular/cli
Solution 9 - node.js
In my case, that's a typo error:
change trct-js-sdk
to trtc-js-sdk
saved my life.
Solution 10 - node.js
My solution was as follows because I had a dependency on a private package. If you see the dependency in package.json defined in the format @scope/package, then @scope tells you that it's a scoped package that might be private.
- Get the private package owner to grant you access to the package
- Upgrade npm
- Upgrade node
- Add registry using HTTPS (not HTTP), e.g.
npm config set registry https://registry.npmjs.org
- Do "npm login"
- Now run the build
Solution 11 - node.js
It is an network error , check your network connection and try to install it again.
Solution 12 - node.js
the only command line "npm -g install npm" solved the issue for me! the following link can be helpful to dig deep for a better understanding. Thanks a lot.