question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm publish has resulted in error "You need to authorize this machine using `npm adduser`"

See original GitHub issue

Hi,

In the 08 Publish chapter I was not able to npm publish against the .npmrc local environment. However it worked when the .npmrc file removed and with a connection to https://www.npmjs.com/. None of the following chapters worked correctly either against this local environment, and all worked well again without the .npmrc file and with a connection to https://www.npmjs.com/.

I once went through the 02 Login chapter smoothly and npm whoami returned the correct info. At this point running npm whoami also results in authentication errors.

Looking at the path that userconfig in .npmrc pointed to (userconfig = /Users/xiaoli.shen/.config/how-to-npm/npmrc), there is no such file or folder named npmrc, which might be the reason for the authentication errors.

I’m using version 2.0.0 of how-to-npm and on Mac OS 10.9.5

My npm-debug.log is as follows:

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'adduser' ]
2 info using npm@2.11.1
3 info using node@v0.12.4
4 verbose adduser before first PUT { _id: 'org.couchdb.user:alabebop',
4 verbose adduser   name: 'alabebop',
4 verbose adduser   password: 'XXXXX',
4 verbose adduser   email: 'alabebop@gmail.com',
4 verbose adduser   type: 'user',
4 verbose adduser   roles: [],
4 verbose adduser   date: '2015-06-11T09:07:53.405Z' }
5 verbose request uri http://localhost:15443/-/user/org.couchdb.user:alabebop
6 verbose request new user, so can't send auth
7 info attempt registry request try #1 at 11:07:53
8 verbose request id 8f19ff7f3662cb4c
9 http request PUT http://localhost:15443/-/user/org.couchdb.user:alabebop
10 info retry will retry, error on last attempt: Error: connect ECONNREFUSED
11 info attempt registry request try #2 at 11:08:03
12 http request PUT http://localhost:15443/-/user/org.couchdb.user:alabebop
13 info retry will retry, error on last attempt: Error: connect ECONNREFUSED
14 info attempt registry request try #3 at 11:09:03
15 http request PUT http://localhost:15443/-/user/org.couchdb.user:alabebop
16 verbose request invalidating /Users/xiaoli.shen/.npm/localhost_15443/-/user/org.couchdb.user_3Aalabebop on PUT
17 verbose adduser back [ { [Error: connect ECONNREFUSED]
17 verbose adduser     code: 'ECONNREFUSED',
17 verbose adduser     errno: 'ECONNREFUSED',
17 verbose adduser     syscall: 'connect' },
17 verbose adduser   undefined,
17 verbose adduser   undefined ]
18 verbose stack Error: connect ECONNREFUSED
18 verbose stack     at exports._errnoException (util.js:746:11)
18 verbose stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
19 verbose cwd /Users/xiaoli.shen/projects/nodeschool/how-to-npm
20 error Darwin 13.4.0
21 error argv "node" "/usr/local/bin/npm" "adduser"
22 error node v0.12.4
23 error npm  v2.11.1
24 error code ECONNREFUSED
25 error errno ECONNREFUSED
26 error syscall connect
27 error Error: connect ECONNREFUSED
27 error     at exports._errnoException (util.js:746:11)
27 error     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
27 error  { [Error: connect ECONNREFUSED]
27 error   code: 'ECONNREFUSED',
27 error   errno: 'ECONNREFUSED',
27 error   syscall: 'connect' }
28 error If you are behind a proxy, please make sure that the
28 error 'proxy' config is set properly.  See: 'npm help config'
29 verbose exit [ 1, true ]

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:33 (1 by maintainers)

github_iconTop GitHub Comments

103reactions
AnandWalvekarcommented, Jul 29, 2015

It go resolved!!!

  1. Switch to Login module (by typing “how-to-npm” on command line)
  2. Type “npm adduser” to login
  3. Type “npm whoami” to confirm if logged in
  4. Switch back to the package at which you are getting error(my case it was Publish Again)
  5. Type “npm publish”
  6. Done
66reactions
petermetzcommented, May 24, 2018

My issue was that I had the publishConfig object specified in package.json which defined an invalid URL (some private registry). Had to set it up like this:

  "publishConfig": {
    "registry": "https://registry.npmjs.org/"
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

`npm publish` and `npm install` fail depending on `.npmrc ...
NPM's documentation states there is no need to include the authToken in the project .npmrc . Authenticating with npm login and storing the ......
Read more >
npm publish giving error (need auth This command ... - GitLab
Now I want to publish it in Gitlab package registry. ... npm ERR! need auth You need to authorize this machine using `npm...
Read more >
NPM publish does not work with the correct NPM_TOKEN
I am using semantic-release, with a custom plugin to publish ... npm ERR! need auth You need to authorize this machine using npm...
Read more >
npm-adduser
When authenticating on a new machine, the username, password and email address must all match with your existing record. npm login is an ......
Read more >
Set up your client's npmrc - Azure Artifacts - Microsoft Learn
vsts-npm-auth is not recognized ... If you're running into the following error: ... Then it's likely that the npm modules folder is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found