Skip to content

fix: reinstall a cached package manager when its recorded bins are missing - #902

Open
abappi19 wants to merge 1 commit into
nodejs:mainfrom
abappi19:corepack-stale-cache-bin
Open

abappi19 wants to merge 1 commit into
nodejs:mainfrom
abappi19:corepack-stale-cache-bin

Conversation

@abappi19

@abappi19 abappi19 commented Oct 6, 2026

Copy link
Copy Markdown

Fixes #901

  • Corepack <=0.34.4 caches pnpm 12 with bin: ./bin/pnpm.cjs, a file pnpm 12 doesn't ship. Later releases reuse that record as is and fail with Cannot find module.
  • installVersion now checks the recorded bins before reusing a cache entry. If none of them exist, it removes the folder and installs again, which writes a fresh .corepack.
  • It only reinstalls when every recorded bin is missing. Some packages don't ship every bin in the config (e.g. old pnpm without pnpx.js), so "any missing" would download again on every run.

Testing:

AI disclosure: I used a coding agent to help write the change and the test. I reproduced the bug, reviewed the diff and ran the tests myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot find module .../bin/pnpm.cjs after upgrading from Corepack <=0.34.4 with pnpm 12 cached

1 participant