Skip to content
Latchkey

npm cache clean: Usage, Options & Common Errors

Clear or verify the local npm cache.

npm cache clean wipes the on-disk package cache. Modern npm self-heals the cache, so npm cache verify is usually the better first move.

What it does

clean removes cached tarballs and metadata, but npm refuses unless you pass --force because the cache is content-addressable and rarely the real problem. verify checks and repairs the cache without deleting everything, which fixes most corruption without a slow re-download.

Common usage

Terminal
npm cache verify            # check and repair (preferred)
npm cache clean --force     # nuke the cache
npm config get cache        # where the cache lives

Common CI gotcha: cache clean is rarely the fix

Pipelines that run npm cache clean --force on every build throw away the cache that speeds installs, making CI slower for no benefit. For EINTEGRITY/checksum errors prefer npm cache verify; only clean --force if verify does not resolve it.

Terminal
npm cache verify || npm cache clean --force

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →