`npm adduser` authentication error in NPM 6.4.1 & Artifactory 5.4.6

4.9k Views Asked by At

I set up a private NPM repo on Artifactory 5.4.6.

In NPM 3.10.10, I was able to create credentials for this, using the following command, starting from an empty ~/.npmrc :

npm adduser --registry=https://artifactory.luciad.com/artifactory/api/npm/product_release_npm --scope=@luciad --always-auth

When I try to run the exact same command in NPM 6.4.1, with the exact same credentials, for the exact same private repo with the exaxt same settings, also starting from an empty ~/.npmrc, I get the following error :

npm ERR! code E404
npm ERR! 404 Registry returned 404 for PUT on https://artifactory.luciad.com/artifactory/api/npm/-/user/org.couchdb.user:jslegers
npm ERR! 404
npm ERR! 404  'org.couchdb.user:jslegers' 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!     C:\Users\jslegers.LUCIAD\AppData\Roaming\npm-cache\_logs\2019-01-30T16_00_02_039Z-debug.log

When I look at the log file, I see the following :

 6 http request → POST https://artifactory.luciad.com/artifactory/api/npm/-/v1/login
7 http 404 ← Not Found (https://artifactory.luciad.com/artifactory/api/npm/-/v1/login)
8 verbose web login not supported, trying couch
9 verbose login before first PUT { _id: 'org.couchdb.user:jslegers',
9 verbose login   name: 'jslegers',
9 verbose login   password: 'XXXXX',
9 verbose login   type: 'user',
9 verbose login   roles: [],
9 verbose login   date: '2019-01-30T16:00:02.008Z' }
10 http request → PUT https://artifactory.luciad.com/artifactory/api/npm/-/user/org.couchdb.user:jslegers
11 http 404 ← Not Found (https://artifactory.luciad.com/artifactory/api/npm/-/user/org.couchdb.user:jslegers)
12 verbose adduser before first PUT { _id: 'org.couchdb.user:jslegers',
12 verbose adduser   name: 'jslegers',
12 verbose adduser   password: 'XXXXX',
12 verbose adduser   email: '[email protected]',
12 verbose adduser   type: 'user',
12 verbose adduser   roles: [],
12 verbose adduser   date: '2019-01-30T16:00:02.024Z' }
13 http request → PUT https://artifactory.luciad.com/artifactory/api/npm/-/user/org.couchdb.user:jslegers
14 http 404 ← Not Found (https://artifactory.luciad.com/artifactory/api/npm/-/user/org.couchdb.user:jslegers)
15 verbose stack Error: Registry returned 404 for PUT on https://artifactory.luciad.com/artifactory/api/npm/-/user/org.couchdb.user:jslegers

And idea why npm adduser is failing here?

If I re-use the credentials I created with NPM 3.10.10, I’m able to publish without any problems using NPM 6.4.1, so it’s definitely not an authorization issue in Artifactory that is causing this.

According to the release notes, Artifactory 5.4.6 was released in August 7, 2017. Have there perhaps been any changes to the implementation of npm adduser between since August 7, 2017 that could have broken compatibility with older versions of Artifactory?

1

There are 1 best solutions below

1
Khazi Afzal On

was getting same issue:

solved by following steps:


$ npm login
$ enterusername
$ enterincorrectpassword
$ enteremail

you will get error saying invalid login

try logging with valid credentials, you will be able to login.

other steps helpful.

  1. clear cache: $ npm cache clear --force
  2. delete entries in .npmrc file: vi ~/.npmrc delete login amd registry related data in .npmrc file.