yarn set version — Yarn CLI reference
Set the Yarn version used by the local project
Docs/Reference/CLI/set/version
yarn set version
Set the Yarn version used by the local project
yarn set version <VERSION>
This command updates the top-level packageManager field to point to the specified Yarn selector.
It never writes the deprecated yarnPath field.
Examples#
Use the latest stable release of Yarn 6
yarn set version zpm
Use the latest canary release of Yarn 6
yarn set version zpm-canary
Use the latest stable release of Yarn 4
yarn set version berry
Use a specific release
yarn set version 1.22.22