`cache clear` does not remove `lastKnownGood.json` from cache
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 279
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
Current behavior
corepack cache clear does not fully clear the Corepack cache. It leaves behind lastKnownGood.json, removing only the install folder v1 from the Corepack cache.
Expected behavior
The README document says;
corepack cache cleanClears the local
COREPACK_HOMEcache directory.
COREPACK_HOME can be set in order to define where Corepack should install the package managers. By default it is set to %LOCALAPPDATA%\node\corepack on Windows, and to $HOME/.cache/node/corepack everywhere else.
so the expectation is that after executing corepack cache clear on Linux, there will be no files left in the $HOME/.cache/node/corepack directory.
Alternatively, if it is intentional to not delete the lastKnownGood.json file from the Corepack cache, then the documentation should be changed.
Steps to reproduce
Ubuntu 24.04.2 LTS, Node.js 22.14.0 LTS, Corepack 0.32.0
rm -rf ~/.cache/node/corepack
npm install corepack@latest -g
corepack install -g yarn@latest
corepack cache clear
find ~/.cache/node/corepack
Logs
Installing yarn@4.7.0...
/home/mike/.cache/node/corepack
/home/mike/.cache/node/corepack/lastKnownGood.json
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 with the corepack cache clear implementation and the cache behavior described in the README, then reproduce the issue using the listed Ubuntu commands. Done means the command either leaves no files under $HOME/.cache/node/corepack or the README accurately documents the intended exception, with the behavior covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100