I am trying to login to npm by doing npm login and entering username, password, and email but I am receiving the following response:
Registry returned 401 for PUT
npm is saying that I have the incorrect username or password, but I've used the same credentials to login to npmjs.org.
version of node is:
node -v v6.2.2
Solutions with .npmrc and/or npm config were not working for me.
Eventually found the error was for and older npm version with 2fa enabled (see this thread).
So the following should work
npm update npm -g
npm login
-- update
On a different machine this didn't work until I updated NodeJS and did npm i npm -g.
I guess, that you have overdid registry. For checking, please, run npm config get registry. You should see
▶ npm config get registry
https://registry.npmjs.org/
If there is not this message, then use npm config set registry https://registry.npmjs.org/
I had an npmrc located at ~/.npmrc and removed it with rm ~/.npmrc and it seemed to fix the issue.
The file contained an authToken in the registry so I suppose it was conflicting with the login? I'm not sure...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With