Reputation: 27747
The Yarn documentation tells us how to upgrade to the latest version, but does not explain how to upgrade to a specific non-latest version.
I need a specific version to match our CI server.
How do I specify the version that I want?
Upvotes: 11
Views: 30371
Reputation: 16383
On Mac OSX 12.2.1
had following message when tried yarn upgrade v1.22.17
warning Your current version of Yarn is out of date. The latest version is "1.22.17", while you're on "1.22.4".
info To upgrade, run the following command:
$ brew upgrade yarn
success Saved 0 new dependencies.
So just did brew upgrade yarn
and yarn --version
returned 1.22.17
Upvotes: 0
Reputation: 604
run yarn policies set-version <version>
from the project directory
https://classic.yarnpkg.com/en/docs/cli/policies/#toc-policies-set-version
Upvotes: 8
Reputation: 382
As you can see in the documentation, you can provide a version to the curl-install command with the --version
flag.
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version [version]
In case you are using brew:
brew switch yarn [version]
Or maybe you installed it with npm as global package, then update like that:
npm install --global yarn@[version]
Upvotes: 4
Reputation: 27747
You can specify the yarn version using install in the following way:
Assuming you want version 1.7.0
:
yarn upgrade v1.7.0
Upvotes: 0