[Bug?]: Running 'yarn set version' in home directory overrides per-repo Yarn versions
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
“I tried running Yarn v2 CLI on a Yarn v1 project and can’t figure out how to get it to run in classic mode. Even with yarn set version classic
it keeps trying to upgrade my repo.” (complaint tweet)
“You have a .yarnrc.yml in your home directory that contains a yarnPath
pointing to ~/.yarn/releases/xxx.js
” (Correct solution from @arcanis)
“For that to happen, you probably accidentally ran yarn set version
inside your home directory rather than an individual project. Perhaps something we should hard block 🤔” (Additional info from @arcanis)
To reproduce
Sorry, I don’t see how to reproduce this with Sherlock. In general I think the steps are something like:
- Run
yarn set version latest
in~
cd
into some path like~/repos/my-repo
that uses Yarn v1yarn
Environment
Note that this is just from one repo. I got ‘dlx is not found’ on my Yarn v1 repos. And whoops, it’s Yarn v3, not v2 as in the reports.
System:
OS: Linux 5.10 Ubuntu 20.04.3 LTS (Focal Fossa)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
Binaries:
Node: 16.14.0 - /tmp/xfs-cbcaba7c/node
Yarn: 3.1.0-rc.7.git.20210926.hash-f0d86bd4 - /tmp/xfs-cbcaba7c/yarn
Additional context
I think this is different from #4362, but I’m not very familiar. Sorry if it isn’t! 🙂
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:9 (1 by maintainers)
Sure! I think just blocking
yarn set version
in the home directory would be reasonable (and perhaps add a--skip-home-check
in case someone really needs it?)For clarity: I just repro’d this in a bash profile on an alt laptop, too.