yarn set version
Lock the Yarn version used by the project.
Usage
$> yarn set version [--only-if-needed] <version>
Examples
Download the latest release from the Yarn repository :
yarn set version latest
Download the latest classic release from the Yarn repository :
yarn set version classic
Download a specific Yarn 2 build :
yarn set version 2.0.0-rc.30
Switch back to a specific Yarn 1 release :
yarn set version 1.22.1
Details
This command will download a specific release of Yarn directly from the Yarn
GitHub repository, will store it inside your project, and will change the
yarnPath
settings from your project .yarnrc.yml
file to point to the new
file.
A very good use case for this command is to enforce the version of Yarn used by the any single member of your team inside a same project - by doing this you ensure that you have control on Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting a different behavior than you.