首页 > 解决方案 > 无法登录 GitHub 包注册表

问题描述

我正在尝试通过 GitHub 包注册表发布 npm 包,我正在关注文档,当我在输入usernameand后尝试使用以下命令登录时password(即使两者都是正确的),我总是遇到错误。

// Step 2: Authenticate
$ npm login --registry=https://npm.pkg.github.com/

错误日志:

npm login --registry=https://npm.pkg.github.com/
Username: ***********
Password:
Email: (this IS public) *****************
npm ERR! code E401
npm ERR! Registry returned 401 for PUT on https://npm.pkg.github.com/-/user/org.couchdb.user:kgangadhar: Error authenticating user: Bad credentials

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\karth\AppData\Roaming\npm-cache\_logs\2019-10-31T05_35_05_829Z-debug.log

有谁知道如何解决它?

标签: node.jsnpmgithub-package-registry

解决方案


您的 GitHub 帐户是否启用了 2 因素身份验证?如果是这样,请尝试创建个人访问令牌并使用它而不是密码。以下是创建令牌的说明

更新:Github 现在需要所有帐户的个人访问令牌,无论您是否启用了 2fa


推荐阅读