corepack seems to obey LOCALAPPDATA silently
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 279
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
Platform : WSL2
If because of reasons you have WSLENV=WT_SESSION:WT_PROFILE_ID:LOCALAPPDATA/p:USERPROFILE/p:APPDATA/p to pass through LOCALAPPDATA & APPDATA to your WSL2 environment then you get permissions errors when trying to use yarn + corepack
bsh ❯ corepack enable
bsh ❯ COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn install
node:internal/fs/promises:783
return await PromisePrototypeThen(
^
Error: EACCES: permission denied, rename '/mnt/c/Users/.../AppData/Local/node/corepack/v1/corepack-774055-2af6683f.7bd48' -> '/mnt/c/Users/.../AppData/Local/node/corepack/v1/yarn/4.7.0'
at async Object.rename (node:internal/fs/promises:783:10)
at async renameSafe (/home/.../.nvm/versions/node/v22.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:21935:5)
at async installVersion (/home/.../.nvm/versions/node/v22.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:21903:5)
at async Engine.ensurePackageManager (/home/.../.nvm/versions/node/v22.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22323:32)
at async Engine.executePackageManagerRequest (/home/.../.nvm/versions/node/v22.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22423:25)
at async Object.runMain (/home/.../.nvm/versions/node/v22.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:23110:7) {
errno: -13,
code: 'EACCES',
syscall: 'rename',
path: '/mnt/c/Users/.../AppData/Local/node/corepack/v1/corepack-774055-2af6683f.7bd48',
dest: '/mnt/c/Users/.../AppData/Local/node/corepack/v1/yarn/4.7.0'
}
This never used to happen, and I'm not sure if it's 'yarn' or 'corepack' that is the issue (there aren't any PRs or issues that mention appdata that seem related).
My current workaround is to use direnv to unset both those environment variables
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 WSL2 setup with WSLENV passing through LOCALAPPDATA and APPDATA, then trace the failing rename in dist/lib/corepack.cjs during corepack enable and yarn install. Done means Corepack handles this environment without an EACCES failure, with behavior covered by an appropriate regression test.
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
- 38/100