Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular `ng update @angular/...` returns `401 Unauthorized`

npm -v returns 6.0.0

node -v returns v10.0.0

Angular CLI local and global version is 6.0.0

I create a new package with ng new sample, run npm install without issue, and then I try ng update @angular/core or ng update @angular/cli and get 401 Unauthorized in response.

Trying to run update on an already Angular 6 repository does seem redundant but I also have this issue with an Angular 5 repository.

ng5-sample git:(ng6) ✗ ng update @angular/core, 401 Unauthorized

I don't have a lot to go on from this error, is it something to do specifically with ng update or more likely to be some unrelated configuration outside of it?

like image 272
MattTreichel Avatar asked May 04 '18 17:05

MattTreichel


1 Answers

I was struggling with the same error message. For me it was caused by a custom .npmrc in the project directory which contained information about howto connect to our npm registry.

Here's how I resolved it:

  1. removed the file during the update (mv .npmrc backup.npmrc)
  2. removed all dependencies to artifacts from our internal npm registry from the package.json
  3. ran ng update @angular/cli
  4. moved file back to old position mv backup.npmrc .npmrc
  5. ran npm install (just to make sure)

I also created an angular-cli issue at https://github.com/angular/angular-cli/issues/10704

like image 73
Korgen Avatar answered Oct 25 '22 17:10

Korgen