Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing npm package fails with 404

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 
like image 524
theandroid Avatar asked Nov 27 '17 21:11

theandroid


People also ask

What to do if npm install fails?

The best way to solve the issue is by updating Node. js and all your dependencies to the latest stable version as explained above. And that's how you fix the npm error code 1 issue in your project.

Why I Cannot install npm?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).

How do I force an npm package to install?

The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk. The -g or --global argument will cause npm to install the package globally rather than locally.


2 Answers

npm config set registry http://registry.npmjs.org 

NPM registry documentation

like image 178
Matt Avatar answered Oct 09 '22 16:10

Matt


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

like image 33
Alexus Avatar answered Oct 09 '22 17:10

Alexus