Reputation: 78
Background:
I have a new installation of Nexus OSS 3 with which I have configured a repository to proxy to the official NPM repo. I have added users and added 'npm Bearer Token Realm' to my list of active realms. Repository status is "Online - Remote Connection Pending..." and the user I'm trying to connect with currently has admin access.
Problem:
I am attempting to login to the repo from two different systems, each using different versions of node 0.10.x (currently required for dev needs) and npm (one that came packaged with node, one updated to current). On one system I get a 405 error with the following output:
~$ npm login --loglevel verbose --registry=https://repo.xxx.com/repository/xxxx-npm/
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'login',
npm verb cli '--loglevel',
npm verb cli 'verbose',
npm verb cli '--registry=https://repo.xxx.com/repository/xxx-npm/' ]
npm info using [email protected]
npm info using [email protected]
npm verb config Skipping project config: /home/ubuntu/.npmrc. (matches userconfig)
Username: (user.name)
Password: (or leave unchanged)
Email: (this IS public) ([email protected])
npm verb adduser before first PUT { name: 'user.name',
npm verb adduser password: 'XXXXX',
npm verb adduser email: '[email protected]',
npm verb adduser _id: 'org.couchdb.user:user.name',
npm verb adduser type: 'user',
npm verb adduser roles: [],
npm verb adduser date: '2016-09-22T17:41:52.249Z' }
npm verb request where is /-/user/org.couchdb.user:user.name
npm verb request registry https://repo.xxx.com/
npm verb request id f911025c53b0616e
npm verb url raw /-/user/org.couchdb.user:user.name
npm verb url resolving [ 'https://repo.xxx.com/',
npm verb url resolving './-/user/org.couchdb.user:user.name' ]
npm verb url resolved https://repo.xxx.com/-/user/org.couchdb.user:user.name
npm verb request where is https://repo.xxx.com/-/user/org.couchdb.user:user.name
npm info trying registry request attempt 1 at 10:41:52
npm http PUT https://repo.xxx.com/-/user/org.couchdb.user:user.name
npm http 405 https://repo.xxx.com/-/user/org.couchdb.user:user.name
npm verb headers { date: 'Thu, 22 Sep 2016 17:41:52 GMT',
npm verb headers server: 'Nexus/3.0.2-02 (OSS)',
npm verb headers 'x-frame-options': 'SAMEORIGIN',
npm verb headers 'x-content-type-options': 'nosniff',
npm verb headers connection: 'close' }
npm verb adduser back [ '405 Method Not Allowed', null, undefined ]
npm ERR! 405 Method Not Allowed
npm verb exit [ 1, true ]
npm ERR! not ok code 0
On the second system I get a 404 error with the following output:
npm login --registry=https://repo.xxx.com/repository/xxx-npm/
Username: user.name
Password:
Email: (this IS public) [email protected]
npm ERR! Linux 3.13.0-91-generic
npm ERR! argv "node" "/home/ubuntu/nvm/v0.10.46/bin/npm" "login" "--registry=https://repo.xxx.com/repository/xxx-npm/"
npm ERR! node v0.10.46
npm ERR! npm v3.10.8
npm ERR! code E404
npm ERR! 404 Not Found
npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/xvela-app/npm-debug.log
And here is the npm-debug.log from that attempt:
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/home/ubuntu/nvm/v0.10.46/bin/npm',
1 verbose cli 'login',
1 verbose cli '--registry=https://repo.xxx.com/repository/xxx-npm/' ]
2 info using [email protected]
3 info using [email protected]
4 verbose adduser before first PUT { _id: 'org.couchdb.user:user.name',
4 verbose adduser name: 'user.name',
4 verbose adduser password: 'XXXXX',
4 verbose adduser email: '[email protected]',
4 verbose adduser type: 'user',
4 verbose adduser roles: [],
4 verbose adduser date: '2016-09-22T16:37:53.671Z' }
5 verbose request uri https://repo.xxx.com/repository/xxx-npm/-/user/org.couchdb.user:user.name
6 verbose request new user, so can't send auth
7 info attempt registry request try #1 at 16:37:53
8 verbose request id e00f9c93ae664e01
9 http request PUT https://repo.xxx.com/repository/xxx-npm/-/user/org.couchdb.user:user.name
10 http 404 https://repo.xxx.com/repository/xxx-npm/-/user/org.couchdb.user:user.name
11 verbose headers { date: 'Thu, 22 Sep 2016 16:37:54 GMT',
11 verbose headers server: 'Nexus/3.0.2-02 (OSS)',
11 verbose headers 'x-frame-options': 'SAMEORIGIN',
11 verbose headers 'x-content-type-options': 'nosniff',
11 verbose headers connection: 'close' }
12 verbose request invalidating /home/ubuntu/.npm/repo.xxx.com/repository/xxx-npm/-/user/org.couchdb.user_3Auser.name on PUT
13 verbose adduser back [ { [Error: 404 Not Found] statusCode: 404, code: 'E404' },
13 verbose adduser null,
13 verbose adduser undefined ]
14 verbose stack Error: 404 Not Found
14 verbose stack at makeError (/home/ubuntu/nvm/v0.10.46/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:302:12)
14 verbose stack at CachingRegistryClient.<anonymous> (/home/ubuntu/nvm/v0.10.46/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:253:9)
14 verbose stack at Request._callback (/home/ubuntu/nvm/v0.10.46/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:210:14)
14 verbose stack at Request.self.callback (/home/ubuntu/nvm/v0.10.46/lib/node_modules/npm/node_modules/request/request.js:187:22)
14 verbose stack at Request.emit (events.js:98:17)
14 verbose stack at Request.<anonymous> (/home/ubuntu/nvm/v0.10.46/lib/node_modules/npm/node_modules/request/request.js:1044:10)
14 verbose stack at Request.emit (events.js:95:17)
14 verbose stack at IncomingMessage.<anonymous> (/home/ubuntu/nvm/v0.10.46/lib/node_modules/npm/node_modules/request/request.js:965:12)
14 verbose stack at IncomingMessage.emit (events.js:117:20)
14 verbose stack at _stream_readable.js:944:16
15 verbose statusCode 404
16 verbose cwd /home/ubuntu/xxx-app
17 error Linux 3.13.0-91-generic
18 error argv "node" "/home/ubuntu/nvm/v0.10.46/bin/npm" "login" "--registry=https://repo.xxx.com/repository/xxx-npm/"
19 error node v0.10.46
20 error npm v3.10.8
21 error code E404
22 error 404 Not Found
23 verbose exit [ 1, true ]
I've wikigoogled the heck out of this and Nexus itself isn't showing any evidence of these connection attempts in it's logs. Any help would be much appreciated.
Cheers!
Upvotes: 1
Views: 7568
Reputation: 5320
The npm login command currently doesn't work for proxy npm repositories (it does work for group and hosted repositories though).
https://issues.sonatype.org/browse/NEXUS-10149
That's getting fixed in the 3.1 release.
Try putting your proxy repo into a group repo, and using the group repo's URL.
Upvotes: 1