node.jsyarnpkgnvmcorepackyarnpkg-v4

Why does corepack try to install yarn v1.22 by default when v4.11 is the latest?


I can see corepack about to download yarn v1.22 when I run the yarn command:

user@laptop:~/empty-directory$ yarn
Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz.

Do you want to continue? [Y/n]

I'm using corepack v0.25.2.

The latest release of yarn is v4.11 at the time of writing: https://github.com/yarnpkg/berry/releases

Why is this version being downloaded, and how can I make yarn 4.1.1 the default version that Corepack uses?


Solution

  • If the packageManager field in package.json is not specified, Corepack will download the global version of the package manager that Corepack is configured with (Corepack also calls these 'Known Good Releases'). To use a different version of yarn, you can either:


    Links