Join the waitlistJoin
← All cleanup guides
npm

npm cache: is it safe to delete?

The download cache of npm; every package in it can be downloaded again from the registry.

Where it lives
  • ~/.npm/_cacache
Risk
Low risk. The tool rebuilds it when needed, so SPACE256 preselects it in Review.
Comes back on its own
Yes
If you delete it
The next npm install downloads its packages again and cannot work offline until it has.
What SPACE256 does
Runs the tool's own cleanup command, only after the tool reports this exact folder, after you confirm in Review with a press and hold.

Cleaned with the tool's own commandnpm cache clean --force

What it is

npm keeps a copy of every package tarball it downloads in a content-addressed cache in your home folder, ~/.npm/_cacache. When a project installs a package npm has seen before, it copies it from this cache instead of downloading it again.

Why it grows

The cache keeps every version of every package you ever installed, across all projects, and npm never removes old entries on its own. Years of installs, and CI-like workflows on a laptop, leave gigabytes of versions nobody uses any more.

When to clear it

Any time you need space and have a network connection for your next install. It is one of the safest caches on a developer’s Mac.

When to keep it

If you need to install packages offline soon, keep it: with an empty cache, npm install needs the registry until it has downloaded everything again.

How SPACE256 clears it

SPACE256 runs npm’s own command, npm cache clean --force, and only after npm reports exactly this folder as its cache, so npm decides what is removed.

Questions

Is `npm cache clean --force` safe?

Yes. It empties npm's download cache only. Your projects and their node_modules folders are untouched; npm downloads packages again the next time an install needs them.

Why is `--force` needed?

npm verifies its cache on its own and asks for `--force` so the cache isn't cleared by accident. Clearing it is still safe.

Get SPACE256 at launch