69

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
theandroid
  • 809
  • 1
  • 6
  • 13
  • 1
    What's your question? It looks like @angular/cli doesn't exist. – EvSunWoodard Nov 27 '17 at 21:37
  • 3
    See this question's top answer, and use the default npm registry location: https://stackoverflow.com/questions/22385092/npm-config-set-registry-https-registry-npmjs-org-is-not-working-in-windows . Registry: https://registry.npmjs.org/ – EvSunWoodard Nov 27 '17 at 21:51
  • 1
    Yep, That was it. Can't thank you enough!! Your answer made my day! – theandroid Nov 27 '17 at 22:08

18 Answers18

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

NPM registry documentation

Community
  • 1
  • 1
Matt
  • 1,068
  • 6
  • 10
19

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

Atul Baldaniya
  • 761
  • 8
  • 14
13

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

Alexus
  • 1,887
  • 1
  • 23
  • 50
  • Same here. Had to delete .npmrc (was trying to install private package) , then do npm install and once it worked I restored the .npmrc back to the project – codeinprogress May 04 '21 at 08:25
  • I had an issue with my .npmrc file. There were some mandatory entries that I had missed. – Sanke Sep 16 '21 at 09:12
5

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.

nick
  • 425
  • 4
  • 12
4

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

Abhay
  • 171
  • 1
  • 4
3

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

Niyongabo Eric
  • 1,333
  • 18
  • 21
3

I spent hours on this.

I had to follow the below steps to get it to work (mac).

Delete my LOCAL (not project) .npmrc by running:

rm /Users/<NAME>/.npmrc

Then set the registry:

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

Then follow the steps for logging in to npm:

npm login

Check what's in your config list by running:

npm config list

It should look like this:

//registry.npmjs.org/:_authToken = (protected)
registry = "https://registry.npmjs.org/"

Hope it works for you too.

Harry Riley
  • 165
  • 1
  • 6
2

I had same problem with a private package. Need to:

  • npm adduser
  • npm login
Cabezas
  • 9,329
  • 7
  • 67
  • 69
Ronen
  • 807
  • 1
  • 13
  • 33
1

When I looked for .npmrc in home folder I couldn’t find it.

But and after running:

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

This fixed my problem.

Parking Master
  • 551
  • 1
  • 4
  • 20
0
  1. change your access level to public. type this in the terminal
npm --access=public
  1. install your angular.
sudo npm install @ngular/cli
IlGala
  • 3,331
  • 4
  • 35
  • 49
0

In my case, that's a typo error:
change trct-js-sdk to trtc-js-sdk saved my life.

NOZUONOHIGH
  • 1,892
  • 1
  • 20
  • 20
0

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.

  1. Get the private package owner to grant you access to the package
  2. Upgrade npm
  3. Upgrade node
  4. Add registry using HTTPS (not HTTP), e.g. npm config set registry https://registry.npmjs.org
  5. Do "npm login"
  6. Now run the build
Puneet Lamba
  • 755
  • 8
  • 15
0

Worked for me

I got

error 404 'dotnev@*' is not in this registry.

Deleted .npmrc file in 2 folders back over my project root and then in the project root folder typed:

npm i dotenv

copied from: https://www.npmjs.com/package/dotenv

Lee Taylor
  • 7,761
  • 16
  • 33
  • 49
Shamir
  • 1
  • 1
0

Uninstall NPM & nodejs and install the right way NPM (Ubuntu)

sudo with npm is not recommended

To Uninstall

sudo apt-get remove nodejs
sudo apt-get remove npm

or

sudo apt-get purge nodejs
  1. Followed by proper installation

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

  1. To confirm open a new terminal run:

$ command -v nvm

  1. Latest LTS release of NodeJS:

$ nvm install --lts

  1. Set default environment

$ nvm alias default lts/*

Ndiklas
  • 77
  • 1
  • 6
0

Just run sudo npm config set registry http://registry.npmjs.org and then update your npm.

0

I had the same problem. What did I do?

First I deleted the .npmrc file in home/user

  • ls -a
  • sudo rm .npmrc

Then I downgraded my npm to a lower version

  • npm install -g npm@8.19.4

Then in my application I deleted the node_module package and runned the npm install.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
-1

It is an network error , check your network connection and try to install it again.

-1

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.