Yarn: Logged in, still refuses to publish

Created on 14 Oct 2017  ·  4Comments  ·  Source: yarnpkg/yarn

yarn v1.1.0 refuses me to publish a package and doesn't say why.

First, I am logged in fine, see:

└─❱❱❱ yarn login
yarn login v1.1.0
question npm username: michael.heuberger
question npm email: [email protected]
Done in 9.95s.

Then trying to publish that:

└─❱❱❱ yarn publish --new-version 2.1.23
yarn publish v1.1.0
[1/4] Bumping version...
info Current version: 2.1.23
[2/4] Logging in...
[3/4] Publishing...
error An unexpected error occurred: "https://registry.yarnpkg.com/videomail-client: You must be logged in to publish packages.".
info If you think this is a bug, please open a bug report with the information provided in "/home/michael-heuberger/code/videomail-client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.

that error log doesn't say why. And there is this stack trace

Trace: 
  Error: https://registry.yarnpkg.com/videomail-client: You must be logged in to publish packages.
      at Request.params.callback [as _callback] (/usr/share/yarn/lib/cli.js:61779:18)
      at Request.self.callback (/usr/share/yarn/lib/cli.js:121917:22)
      at emitTwo (events.js:125:13)
      at Request.emit (events.js:213:7)
      at Request.<anonymous> (/usr/share/yarn/lib/cli.js:122900:10)
      at emitOne (events.js:115:13)
      at Request.emit (events.js:210:7)
      at IncomingMessage.<anonymous> (/usr/share/yarn/lib/cli.js:122820:12)
      at Object.onceWrapper (events.js:314:30)
      at emitNone (events.js:110:20)

Can you please at least print a better erorr message why it can't be published?

Most helpful comment

@binarykitchen do you know the exact steps that fixed it for you? I ran npm logout and npm login again, but that doesn't seem to have worked.

Edit: Nevermind, rm ~/.npmrc followed by npm login finally worked.

All 4 comments

Also happens on latest version v1.2.1. Here again the whole output with the verbose flag

└─❱❱❱ yarn publish --new-version 2.1.23 --verbose
yarn publish v1.2.1
verbose 0.791 Checking for configuration file "/home/michael-heuberger/code/videomail-client/.npmrc".
verbose 0.791 Checking for configuration file "/home/michael-heuberger/.npmrc".
verbose 0.791 Found configuration file "/home/michael-heuberger/.npmrc".
verbose 0.792 Checking for configuration file "/home/michael-heuberger/.nvm/versions/node/v8.3.0/etc/npmrc".
verbose 0.792 Checking for configuration file "/home/michael-heuberger/code/videomail-client/.npmrc".
verbose 0.792 Checking for configuration file "/home/michael-heuberger/code/.npmrc".
verbose 0.792 Checking for configuration file "/home/michael-heuberger/.npmrc".
verbose 0.793 Found configuration file "/home/michael-heuberger/.npmrc".
verbose 0.793 Checking for configuration file "/home/.npmrc".
verbose 0.796 Checking for configuration file "/home/michael-heuberger/code/videomail-client/.yarnrc".
verbose 0.796 Checking for configuration file "/home/michael-heuberger/.yarnrc".
verbose 0.796 Found configuration file "/home/michael-heuberger/.yarnrc".
verbose 0.796 Checking for configuration file "/home/michael-heuberger/.nvm/versions/node/v8.3.0/etc/yarnrc".
verbose 0.797 Checking for configuration file "/home/michael-heuberger/code/videomail-client/.yarnrc".
verbose 0.797 Checking for configuration file "/home/michael-heuberger/code/.yarnrc".
verbose 0.797 Checking for configuration file "/home/michael-heuberger/.yarnrc".
verbose 0.797 Found configuration file "/home/michael-heuberger/.yarnrc".
verbose 0.797 Checking for configuration file "/home/.yarnrc".
verbose 0.8 current time: 2017-10-13T23:19:51.680Z
[1/4] Bumping version...
info Current version: 2.1.23
[2/4] Logging in...
[3/4] Publishing...
verbose 1.297 Performing "PUT" request to "https://registry.yarnpkg.com/videomail-client".
verbose 5.036 Request "https://registry.yarnpkg.com/videomail-client" finished with status code 401.
verbose 5.038 Error: https://registry.yarnpkg.com/videomail-client: You must be logged in to publish packages.
    at Request.params.callback [as _callback] (/home/michael-heuberger/.nvm/versions/node/v8.3.0/lib/node_modules/yarn/lib/cli.js:62027:18)
    at Request.self.callback (/home/michael-heuberger/.nvm/versions/node/v8.3.0/lib/node_modules/yarn/lib/cli.js:123011:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/home/michael-heuberger/.nvm/versions/node/v8.3.0/lib/node_modules/yarn/lib/cli.js:123994:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (/home/michael-heuberger/.nvm/versions/node/v8.3.0/lib/node_modules/yarn/lib/cli.js:123914:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
error An unexpected error occurred: "https://registry.yarnpkg.com/videomail-client: You must be logged in to publish packages.".
info If you think this is a bug, please open a bug report with the information provided in "/home/michael-heuberger/code/videomail-client/yarn-error.log".

I think because it scans for so many .npmrc files, it could be that one is bad. That said, would be great to print the credentials it was trying to publish for. Makes it easier to find the cause. Would you accept a PR for that?

Any news on this one? It's still bugging me ...

Ah, I had an outdated .npmrc config and had to re-login. Wish the error msg was better.

@binarykitchen do you know the exact steps that fixed it for you? I ran npm logout and npm login again, but that doesn't seem to have worked.

Edit: Nevermind, rm ~/.npmrc followed by npm login finally worked.

Was this page helpful?
0 / 5 - 0 ratings