Skip to content
Discussion options

You must be logged in to vote

Yarn Switch doesn't currently have a persistent semver equivalent to Corepack's prepare --activate. It is project-first: it reads the nearest package.json and runs the exact version from packageManager.

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 yarn commands in that project will use that version. yarn switch up updates the current project's packageManager to the latest release on its configured line.

A command such as yarn switch ^4 --version selects Yarn 4 only for that invocation. Outside a project, Switch falls back to its built-in default/stable cha…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by akkadaya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants