`npm login` fails with `E404`

905 Views Asked by At

I am trying to login onto a NPM registry but it fails with a HTTP 404 error:

$ npm adduser --registry=https://<forge>/artifactory/api/npm/<repo>
Username: <user>
Password:
Email: (this IS public) <user>@<company>.com
npm ERR! code E404
npm ERR! 404 Registry returned 404 for PUT on https://<forge>/artifactory/api/npm/-/user/org.couchdb.user:<user>
npm ERR! 404
npm ERR! 404  'org.couchdb.user:<user>' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404  1. name can only contain URL-friendly characters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jenkins/.npm/_logs/2021-09-10T09_59_55_596Z-debug.log

Any idea on what is wrong?

1

There are 1 best solutions below

0
On

I solved it by adding a trailing slash at the end of the registry URL, idk why NPM seems very meticulous about this:

$ npm adduser --registry=https://<forge>/artifactory/api/npm/<registry>/
Username: <user>
Password:
Email: (this IS public) <user>@<company>.com
Logged in as <user> on https://<forge>/artifactory/api/npm/<registry>/.