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.