Yarn version folder not found when trying to set version while corepack is enabled
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 279
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
OS: Windows 11
Node.js v18.19.0, installed via Windows installer
Yarn v1.22.21 installed globally via npm
Steps:
- Open terminal as admin and run
enable corepack - Navigate to existing yarn project folder or create new with
yarn init - Run
yarn set version berryand you get following kind of error:
Internal Error: ENOENT: no such file or directory, stat 'C:\Users\{username}\AppData\Local\node\corepack\yarn\4.0.2'
When you go check C:\Users\{username}\AppData\Local\node\corepack\yarn there is only folder for version 1.22.21 but not for 4.0.2 which explains the error. When you navigate to C:\Users\{username}\AppData\Local\node\corepack\ a new folder corepack-{someidentifer} has been created there. It seems to contain the yarn.js needed but is in the wrong place?
Any ideas what is causing this behavior? Way around it is to disable corepack and let yarn set version to download yarn binary for the project itself. However, Yarn nowadays recommends to use Corepack so I'd prefer using that if possible. Another workaround is to modify the corepack folders in local appdata but that is just treating the symptoms, not fixing the cause.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure on Windows 11 with Node.js 18.19.0, Yarn 1.22.21, Corepack enabled, and yarn set version berry. Inspect the Corepack cache paths under C:\Users\{username}\AppData\Local\node\corepack\, especially the generated corepack-{someidentifier} folder. Done means the command can obtain and use the requested Yarn version without manual cache changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100