Repository navigation
How to set the default yarn version with yarn switch? #332
|
With corepack I could set the default yarn version. how can I do the same with yarn switch? |
Replies: 1 comment
|
Yarn Switch doesn't currently have a persistent semver equivalent to Corepack's For a project, set an exact version, for example: {
"packageManager": "yarn@<exact-4.x-version>"
}Replace the placeholder with the Yarn 4 release you want. After that, ordinary A command such as |
Yarn Switch doesn't currently have a persistent semver equivalent to Corepack's
prepare --activate. It is project-first: it reads the nearestpackage.jsonand runs the exact version frompackageManager.For a project, set an exact version, for example:
{ "packageManager": "yarn@<exact-4.x-version>" }Replace the placeholder with the Yarn 4 release you want. After that, ordinary
yarncommands in that project will use that version.yarn switch upupdates the current project'spackageManagerto the latest release on its configured line.A command such as
yarn switch ^4 --versionselects Yarn 4 only for that invocation. Outside a project, Switch falls back to its built-indefault/stablecha…