12

I cannot use my pair of username and password to run npm login success in terminal, while

I use a pair of account and password to login npmjs.com website. But when execute npm login in terminal, this error appeared:

npm WARN adduser Incorrect username or password
npm WARN adduser You can reset your account by visiting:
npm WARN adduser
John Xiao
  • 1,680
  • 2
  • 18
  • 24

1 Answers1

25

View npm config through npm config ls, check the 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/"

If you use third party registry like 'taobao.org' etc., you will absolutely get the 'Incorrect username or password' error tip.

Solution

Change back to use official registry npmjs.org temporarily:

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

John Xiao
  • 1,680
  • 2
  • 18
  • 24
  • Also make sure that you are not mistakenly passing a `--registry` argument to the command line. I had this error trying to log into NPM but using `--registry=https://npm.pkg.github.com`. – Zenul_Abidin Sep 16 '21 at 12:34