npm login 输入正确的用户名和密码时仍出现 Incorrect username or password

npm login 输入正确的用户名和密码时仍出现 Incorrect username or password

阅读 22.3k
2 个回答

通过 npm config ls 查看是否使用了非 npmjs.org 官网的 registry。如下:

→ npm config ls
; cli configs
user-agent = "npm/2.14.2 node/v4.0.0 darwin x64"

; userconfig /Users/xxx/.npmrc
email = "xxx@xx.com"
registry = "https://registry.npm.taobao.org/"

使用了 taobao 的 registry 地址造成登录出现如标题所示错误。

解决办法

暂时切换回 npm 官方库地址:

npm config set registry https://registry.npmjs.org/

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进