Angular ng update @angular/...返回401未经授权 [英] Angular `ng update @angular/...` returns `401 Unauthorized`

查看:93
本文介绍了Angular ng update @angular/...返回401未经授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

npm -v返回6.0.0

node -v返回v10.0.0

Angular CLI的本地和全局版本为6.0.0

Angular CLI local and global version is 6.0.0

我用ng new sample创建一个新程序包,运行npm install没有问题,然后尝试ng update @angular/coreng update @angular/cli并得到401 Unauthorized作为响应.

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.

尝试在已经存在的Angular 6存储库上运行更新似乎是多余的,但是我在Angular 5存储库中也遇到了这个问题.

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

对于这个错误,我没有什么可做的,是专门针对ng update还是更可能是其外部的一些无关配置?

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?

推荐答案

我一直在处理相同的错误消息.对我来说,这是由项目目录中的自定义.npmrc引起的,其中包含有关如何连接到我们的npm注册表的信息.

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.

这是我的解决方法:

  1. 在更新过程中删除了文件(mv .npmrc backup.npmrc)
  2. package.json
  3. 的内部npm注册表中删除了对工件的所有依赖关系
  4. 运行ng update @angular/cli
  5. 将文件移回旧位置mv backup.npmrc .npmrc
  6. 运行npm install(只是为了确定)
  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)

我还在 https://github.com/angular创建了angular-cli问题/angular-cli/issues/10704

这篇关于Angular ng update @angular/...返回401未经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆