Self-service
Describe the bug
Corepack is now the recommended way to install/manage Yarn versions and according to the docs it
lets you use different package manager versions across multiple projects without having to check-in the Yarn binary anymore
However, running yarn set version to update Yarn sets yarnPath in the .yarnrc.yml file, so if I check in the other changes made by set version without checking in the binary, trying to run Yarn errors if the binary isn't there (eg. on a fresh checkout).
Given that the documentation says I don't need to check in the Yarn binary, I expect that using the CLI to lock my package manager version in the documented way will not make any changes that would require the binary to be in that location.
To reproduce
- Run
corepack enable
- Create a new directory with a
package.json file containing only:
{ "packageManager": "yarn@3.1.0" }
- Run
yarn -v and observe that it succeeds - corepack is handling it.
- Run
ls -a and observe that the package.json file is the only file in this directory.
- Run
yarn set version 3.1.1.
- Run
rm .yarn/releases/yarn-3.1.1.cjs
- Run
yarn -v and observe the error:
Internal Error: The "yarn-path" option has been set, but the specified location doesn't exist.
- Run
yarn config unset yarnPath
- Run
yarn -v and observe that it succeeds - corepack is handling it again now that the change yarn set version made to yarn config has been reverted.
Environment
System:
OS: macOS 11.6.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 14.19.0 - /private/var/folders/n7/8y3h45rn5jq9lrd744w_m7xh0000gn/T/xfs-8cbd9b83/node
Yarn: 3.1.1 - /private/var/folders/n7/8y3h45rn5jq9lrd744w_m7xh0000gn/T/xfs-8cbd9b83/yarn
npm: 6.14.16 - ~/.nvm/versions/node/v14.19.0/bin/npm
Additional context
No response
Self-service
Describe the bug
Corepack is now the recommended way to install/manage Yarn versions and according to the docs it
However, running
yarn set versionto update Yarn setsyarnPathin the.yarnrc.ymlfile, so if I check in the other changes made byset versionwithout checking in the binary, trying to run Yarn errors if the binary isn't there (eg. on a fresh checkout).Given that the documentation says I don't need to check in the Yarn binary, I expect that using the CLI to lock my package manager version in the documented way will not make any changes that would require the binary to be in that location.
To reproduce
corepack enablepackage.jsonfile containing only:{ "packageManager": "yarn@3.1.0" }yarn -vand observe that it succeeds - corepack is handling it.ls -aand observe that thepackage.jsonfile is the only file in this directory.yarn set version 3.1.1.rm .yarn/releases/yarn-3.1.1.cjsyarn -vand observe the error:Internal Error: The "yarn-path" option has been set, but the specified location doesn't exist.yarn config unset yarnPathyarn -vand observe that it succeeds - corepack is handling it again now that the changeyarn set versionmade to yarn config has been reverted.Environment
System: OS: macOS 11.6.1 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Binaries: Node: 14.19.0 - /private/var/folders/n7/8y3h45rn5jq9lrd744w_m7xh0000gn/T/xfs-8cbd9b83/node Yarn: 3.1.1 - /private/var/folders/n7/8y3h45rn5jq9lrd744w_m7xh0000gn/T/xfs-8cbd9b83/yarn npm: 6.14.16 - ~/.nvm/versions/node/v14.19.0/bin/npmAdditional context
No response