npm login 输入正确的用户名和密码时仍出现 Incorrect username or password
通过 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/