If you try to authenticate against a Nexus server for NPM, you can get some strange errors.
Here is how I tried logging in:
npm login
Username: gsieling
Password:
Email: (this IS public) gary@garysieling.com
And this is what I get:
npm ERR! registry error parsing json
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "c:\\Program Files (x86)\\nodejs\\node.exe" "c:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "login"
npm ERR! node v4.3.1
npm ERR! npm v2.14.12
npm ERR! Unexpected token <
npm ERR!
npm ERR!
npm ERR! 400 - Store operations are only valid for package roots, path: /-/user/org.couchdb.user:gsieling
npm ERR!
npm ERR!
npm ERR!
npm ERR!
npm ERR!
npm ERR!
npm ERR!
npm ERR!
npm ERR! 400 - Store operations are only valid for package roots, path: /-/user/org.couchdb.user:gsieling
npm ERR! Store operations are only valid for package roots, path: /-/user/org.couchdb.user:gsieling
npm ERR!
npm ERR!
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!
npm ERR! Please include the following file with any support request:
npm ERR! e:\Projects\npm-debug.log
The recommended way to fix this is apparently to bypass authentication entirely, by setting up your .npmrc correctly. To find out where this is, type:
npm config list
And the location will be visible.
From here, you can add lines to the file like so:
init.author.name = Gary Sieling
init.author.email = gary@garysieling.com
init.author.url = https://www.garysieling.com
email=gsieling@wingspan.com
always-auth=true
_auth=YWRtaW46YWRtaW4xMjM=
Note that both email addresses are required1. The “_auth” param is admin:admin123 (a Nexus default). If you want to use something else, the nexus documentation2 recommends this:
echo -n 'admin:admin123' | openssl base64