错误!代码 E401 npm 错误!密码不正确或丢失

新手上路,请多包涵

我的节点版本是 10.15.0,NPM 版本是 6.8.4 在将 npm 升级到 14.16.0 并将 npm 升级到 7.6.2 后运行 npm install

收到此错误 -

 npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR!     https://www.npmjs.com/forgot
npm ERR!
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR!     npm login

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xyz/.npm/_logs/2021-04-15T18_55_07_993Z-debug.log

原文由 user15650989 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 3.1k
2 个回答
  1. 如果您还没有这样做,请在升级节点版本后运行命令“npm install”之前尝试删除 package-lock.json 文件。

  2. 如果这不起作用,请尝试删除 $HOME 目录中的 .npmrc 文件,如本文所述。

NPM ERR 代码 E401:无法验证,需要:Bearer 授权

注意 - 删除 package-lock.json 可能有其自身的问题,如本文中所述,因此除非您找到更好的解决方案,否则请使用此解决方案。

删除 `package-lock.json` 以快速解决冲突

原文由 paraS elixiR 发布,翻译遵循 CC BY-SA 4.0 许可协议

在目录中 C/Users/your-windows-username/

删除以下文件:

 .cache
.package
.package-lock
.npmrc

之后,转到您的项目并在终端中运行以下命令

npm i

原文由 jay 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Stack Overflow 翻译
子站问答
访问
宣传栏