SweepBarGet it free

pnpm store: how to prune or clear it and free up space

By EgeTech LTD · October 6, 2026 · 2 min read

pnpm is popular because it saves disk space: every package version is stored once, in a global store, and each project links to it. That is also why disk space with pnpm behaves differently from npm, and why the usual advice, “delete node_modules”, does less than you expect.

Find the store

pnpm store path

On a Mac the answer looks like ~/Library/pnpm/store/v10. To see its size:

du -sh "$(pnpm store path)"

pnpm also keeps a smaller metadata cache, usually in ~/Library/Caches/pnpm.

Why deleting node_modules frees little

In a pnpm project, the packages inside node_modules are links to the files in the store, not separate copies. Delete the project’s node_modules and the files are still in the store, so very little space comes back. The space is in the store itself, and the store only shrinks when you remove packages from it.

Prune: the safe way to shrink it

pnpm store prune

This removes unreferenced packages: versions that no project links to any more, for example after you deleted old projects or updated dependencies. The pnpm documentation describes pruning as not harmful, with one side effect: some future installs may be slower, because a package you removed has to be downloaded again.

The order that frees the most space:

  1. Delete the node_modules of old projects. See how to delete all node_modules folders.
  2. Run pnpm store prune. Now the packages those projects used are unreferenced, and prune removes them.

If the store contains folders pnpm does not recognise, there is a stronger form:

pnpm store prune --force

It also removes those “alien” directories.

Clearing the whole store

You can simply delete the store folder:

rm -rf "$(pnpm store path)"

Installed projects keep working, since their files stay on disk, but you lose the shared copy. Every new install downloads its packages again, and pnpm will rebuild the store as you go. Prune is almost always the better choice, because it only removes what is unused.

What it costs

One caveat about disk usage

Because of the links, du can report sizes that look larger than the real total, and the amount you free by deleting one project is smaller than its node_modules suggests. Look at the store size, not at the project size, when you decide whether pnpm is the problem.

Using more than one package manager? Each has its own cache: see npm cache clean –force and clearing the Yarn and Bun caches. The full checklist covers the rest.

Quick answers

Is pnpm store prune safe?

Yes. It removes packages that no project uses any more. pnpm says pruning is not harmful and can only slow down future installs.

Where is the pnpm store?

Run pnpm store path. On a Mac it is usually a folder under your home Library, such as ~/Library/pnpm/store/v10.

Do my projects break if I delete the store?

Projects that are already installed keep working, because their files are linked from the store and stay on disk. You lose the shared copy, so the next install downloads packages again.