Closed
Description
Self-service
- I'd be willing to implement a fix
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 thepackage.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 changeyarn 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
Activity