Docs/Reference/CLI/set/version

yarn set version

Set the version of Yarn to use with the local project

yarn set version <VERSION>

This command will update the packageManager field in the local project’s top-level package.json file to the specified version.

Unlike in Yarn 2 to 4, it will never set the deprecated yarnPath field.