Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I've just upgraded yarn from v0.25.3 to v0.27.5 and the yarn publish
command does not work anymore.
The error message is the following: You must be logged in to publish packages
.
Here is a verbose log of a publish attempt:
$ yarn publish --verbose
yarn publish v0.27.5
verbose 0.407 Checking for configuration file "/home/hanastaroth/Projets/hanastaroth-ember-common/.npmrc".
verbose 0.408 Checking for configuration file "/home/hanastaroth/.npmrc".
verbose 0.408 Checking for configuration file "/home/hanastaroth/.nvm/versions/node/v6.10.3/.npmrc".
verbose 0.409 Checking for configuration file "/home/hanastaroth/Projets/hanastaroth-ember-common/.npmrc".
verbose 0.409 Checking for configuration file "/home/hanastaroth/Projets/.npmrc".
verbose 0.409 Checking for configuration file "/home/hanastaroth/.npmrc".
verbose 0.409 Checking for configuration file "/home/.npmrc".
verbose 0.41 Checking for configuration file "/home/hanastaroth/Projets/hanastaroth-ember-common/.yarnrc".
verbose 0.41 Checking for configuration file "/home/hanastaroth/.yarnrc".
verbose 0.411 Found configuration file "/home/hanastaroth/.yarnrc".
verbose 0.411 Checking for configuration file "/home/hanastaroth/.nvm/versions/node/v6.10.3/.yarnrc".
verbose 0.411 Checking for configuration file "/home/hanastaroth/Projets/hanastaroth-ember-common/.yarnrc".
verbose 0.411 Checking for configuration file "/home/hanastaroth/Projets/.yarnrc".
verbose 0.411 Checking for configuration file "/home/hanastaroth/.yarnrc".
verbose 0.411 Found configuration file "/home/hanastaroth/.yarnrc".
verbose 0.412 Checking for configuration file "/home/.yarnrc".
verbose 0.415 current time: 2017-07-05T12:19:51.413Z
[1/4] Bumping version...
info Current version: 0.0.9
question New version: 0.0.10
info New version: 0.0.10
[2/4] Logging in...
info npm username: hanastaroth
info npm email: [email protected]
question npm password:
verbose 16.011 Performing "PUT" request to "https://registry.yarnpkg.com/-/user/org.couchdb.user:hanastaroth".
verbose 17.16 Request "https://registry.yarnpkg.com/-/user/org.couchdb.user:hanastaroth" finished with status code 201.
success Logged in.
[3/4] Publishing...
verbose 17.356 Performing "PUT" request to "https://registry.yarnpkg.com/hanastaroth-ember-common".
verbose 18.383 Request "https://registry.yarnpkg.com/hanastaroth-ember-common" finished with status code 401.
verbose 18.384 Error: https://registry.yarnpkg.com/hanastaroth-ember-common: You must be logged in to publish packages
at Request.params.callback [as _callback] (/usr/share/yarn/lib/yarn-cli.js:58200:18)
at Request.self.callback (/usr/share/yarn/lib/yarn-cli.js:114242:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/usr/share/yarn/lib/yarn-cli.js:115225:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/usr/share/yarn/lib/yarn-cli.js:115145:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
error An unexpected error occurred: "https://registry.yarnpkg.com/hanastaroth-ember-common: 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/hanastaroth/Projets/hanastaroth-ember-common/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.
If the current behavior is a bug, please provide the steps to reproduce.
Simply do a yarn publish
on a project.
What is the expected behavior?
No errors.
Please mention your node.js, yarn and operating system version.
Node: v6.10.3
Yarn: v0.27.5
OS: Linux x64 Ubuntu LTS 16.04
/cc @binarykitchen
Ugh, thanks but how could this happen? This is a very important function and got broken. Questioning your test coverage here ... @BYK
I'm pretty sure this commit is the problem
https://github.com/yarnpkg/yarn/commit/9c5311496ce9fe7d3e736e41397a20de7f419edb#diff-b053bee294c216269844e5874039b6caL69
When doing publish, alwaysAuth won't be true and nor in most cases is the packaged scoped.
I think the this.token not being there anymore is the issue. Since publish will set this.token
@binarykitchen I feel the pain and agree with the importance. We are in the process of plugging all these holes. The problem with this particular scenario is us depending on a third-party to test the behavior (NPM's registry). I'll see if we can simulate it in a good way, we should definitely have tests covering this.
@johnf thanks for digging in!
/cc @arcanis for @johnf's comment
Fixed in the PR that will be merged in 0.28, which should land early next week.
@binarykitchen publish
is currently one of the rare untested commands, because of the extra setup required to make it work (we would need some kind of stub registry to run on the CI). We plan to work a lot on pack
and publish
during the next months, so testing should improve along the way 馃槈
good responses mates ;)
so, have you created an issue yet to improve test coverage of publish
with stubs?
@binarykitchen here you go #3842.
great, well done @BYK
Not working still
Well yeah, we haven't made a release yet ;) Should come early next week.
This is in PR #3774 in case anyone is looking for it
Howdy! This should have been fixed along with the 0.28, so I'll close this issue :)
Thanks all, works fine now ;)
any ideas when v0.28.0 is out, on npm?
not working
28.1 is on npm, just not marked stable. You can also try nightlies.
not working for me
not working...
@3den Can you provide any more detail? error messages etc?
The issue for me was that yarn login
was giving me back my username and email, but when trying to yarn publish
, it kept saying I was not logged in.
When I did npm login
, it properly asked me for my username, password and email. yarn login
is now still displaying my correct username and email, but yarn publish
now works as well.
Most helpful comment
any ideas when v0.28.0 is out, on npm?