Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corepack cleanup cache #114

Closed
styfle opened this issue May 31, 2022 · 5 comments · Fixed by #363
Closed

corepack cleanup cache #114

styfle opened this issue May 31, 2022 · 5 comments · Fixed by #363

Comments

@styfle
Copy link
Member

styfle commented May 31, 2022

If the local project is configured for the package manager you're using, Corepack will silently download and cache the latest compatible version.

Does corepack provide any way to delete the cache?

The use case I'm thinking of is CI/CD where you want to set COREPACK_HOME to a cached directory. However, unlike node_modules, it doesn't seem like this directory is ever pruned or cleaned up since its shared between many projects.

On a local machine, its probably fine to just periodically delete it. But for CI/CD, the project is only ever using one version of a package manager so its safe to prune old or unused versions.

For perspective, pnpm versions released in the last 30 days (>=7.0.0) amount to 180 MB. I imagine this will reach GB very quickly.

I'm thinking this can be solved with a new command:

 # delete all except current version defined in package.json
corepack cache clean

# delete all versions that have not been invoked for 30 days
corepack cache clean --before 30d
@summer-wu
Copy link

I find corepack is storing cache at ~/.node/corepack. Maybe you can delete them manually.
image

@ST-DDT
Copy link

ST-DDT commented Apr 17, 2023

I find corepack is storing cache at ~/.node/corepack. Maybe you can delete them manually. image

I'll have a look at implementing this.
Is there an (implementation) variable or something that I can use to get the correct cache path for the current platform?

This one?

export function getInstallFolder() {

@SukkaW
Copy link

SukkaW commented Nov 13, 2023

Now corepack is eating 190 MiB of my disk space. Cache cleaning is becoming more and more important.

image

@styfle
Copy link
Member Author

styfle commented Dec 29, 2023

Its been about a year and I checked again just now:

$ du -sh ~/.cache/node/corepack

1.6G

@SukkaW
Copy link

SukkaW commented Jan 25, 2024

Now corepack is eating 190 MiB of my disk space. Cache cleaning is becoming more and more important.

It is becoming worse:

image

70 days passed and the folder size increased by 130 MiB.

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 a pull request may close this issue.

4 participants