Authentication error on publishing to private NPM repository on Nexus
When you do npm login
or npm adduser
the NPM client creates an authentication token that will be used in future request to the registry. Default NXRM configuration allows only Local Authenticating Realm which doesn't recognise NPM's token. Please make sure you have npm Bearer Token Realm active.
_auth=
replaced with output of btoa('username:userpassword')
and it worked for me.
I did use this btoa from chrome as below.
You need a trailing slash on the end of the registry URL passed into npm adduser
, otherwise npm
will chop off the last segment of the URL, and it won't work.
I encountered this problem today, my solution was to delete all registry entry from my npmrc file:
registry=https://my.nexus.com/repository/npm-snapshots/
Idealy delete anything superfluous, back it up before-hand, in my case my file contained only:
strict-ssl=false
Then you can
npm login --registry=https://my.nexus.com/repository/npm-public/
again.
If that's not working, you also bypass npm login with curl, look at this life saving post.