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 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 
3

14 Answers

npm config set registry 

NPM registry documentation

2

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

2

Try first this commands (in windows run as administrator)

npm config set registry 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

2

Add a .npmrc file in the root of the project. .npmrc will look like below -

@xy:registry= @xy-app:registry=

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.

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 npm install -g @angular/cli 

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

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

  • npm adduser
  • npm login
  1. change your access level to public. type this in the terminal
npm --access=public 
  1. install your angular.
sudo npm install @ngular/cli 

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

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
  5. Do "npm login"
  6. Now run the build

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- | 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/*

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:

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

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.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy