Yarn: `yarn version` not working as stated in docs?

Created on 18 Jan 2017  Â·  15Comments  Â·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
Bug.

What is the current behavior?
yarn version returns the current version of yarn similar to the command yarn --version.

If the current behavior is a bug, please provide the steps to reproduce.
Run the command yarn version in your CLI.

What is the expected behavior?
Unless I'm misinformed, should it not be performing the behavior described in the docs? https://yarnpkg.com/en/docs/cli/version

Running yarn version should output something like the following:

info Current version: 1.0.1
question New version: 1.0.2
info New version: 1.0.2
✨  Done in 9.42s.

Please mention your node.js, yarn and operating system version.
node: 7.4.0
yarn: 0.19.1
os: macOS 10.11.6

cat-bug

Most helpful comment

I think there was a conscious choice to split yarn version that outputs data and yarn version --new-version that takes input.
I think major/minor/patch alias would be reasonable in e.g. yarn version --new-version patch.
If you want to discuss the api, @markmsmith, go ahead and start and RFC.

All 15 comments

Upgraded from 0.18.1 to 0.19.1 today and seeing this as well.
node: v6.7.0
yarn: 0.19.1
os: CentOS 7.3.1611

Also seeing this today after upgrading from 0.18.1 to 0.19.1.

node: v7.2.1
yarn: 0.19.1
os: macOS 10.12.2

0.18.1 still works as expected after downgrade.

cc @bestander - Sounds like a regression in 0.19.x.

Created an issue to track cherry-picks https://github.com/yarnpkg/yarn/issues/2499.
Anyone wants to fix this bug and send a PR?

Thanks for confirming!

I was looking into it. It seems if I comment out L42, it works again. Still investigating...

Edit: That was slightly misleading for me. At L174, by args.unshifting, it gets set as a flag? Still going...

Same here. The upgrade to 0.19 simply outputs the yarn version now, instead of tagging a new version.

Since it's a regression, git bisect could be used to find the commit that changed the behavior, to better understand the context of why the behavior changed.

This is probably not the correct place to ask this, but Is there a way to rollback to an older version? I can't find a way to do it through brew.

@danny-andrews Google returned this question on StackOverflow, maybe it'll be useful for you: https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula. I don't have a Mac any more so I can't test it though.

Alternatively, all the other methods of installing Yarn let you specify the version. If you use the installation script, you can pass a --version command-line argument (eg. ./install.sh --version 0.18.1).

Yeah, I went through all those, but they don't seem to be valid anymore. I reverted to installing via npm for now. Thanks!

Fix will be released in 0.20.1

Sorry to comment on an old issue, but I think there's still a problem with the backwards compatibility of the yarn version command. We've been trying to make the switch from npm, but we found that yarn version doesn't support the ability to bump based on the existing value, eg yarn version minor, which we use in our CI setup.
Is it planned to support this functionality in the future, or is this an intentional departure from npm?
Thanks.

I think there was a conscious choice to split yarn version that outputs data and yarn version --new-version that takes input.
I think major/minor/patch alias would be reasonable in e.g. yarn version --new-version patch.
If you want to discuss the api, @markmsmith, go ahead and start and RFC.

@markmsmith Did you ever pursue that? We're also looking to replace npm with yarn and are a bit surprised at how limited yarn version looks to be compared to npm version

Interested in this as well, npm version is handy for scripts after the version has been bumped

Was this page helpful?
0 / 5 - 0 ratings