npx installs every package it runs into ~/.npm/_npx, one folder per command you typed, and never removes them. npm cache clean --force doesn't touch that folder. On npm 11, npm cache npx ls lists the entries and npm cache npx rm removes them. On older npm, delete ~/.npm/_npx while nothing is running. Nothing you installed in a project depends on it.
How big it gets
I measured mine on 1 November 2026:
$ du -sh ~/.npm/_cacache ~/.npm/_npx # 11M ~/.npm/_cacache # 3.9G ~/.npm/_npx
npm's own download cache was 11 MB. The npx folder next to it was 3.9 GB, 59 folders, from a few months of npx something in tutorials and READMEs. The biggest ones:
| Folder holds | Size | Folder date |
|---|---|---|
| vercel 65.8 | 364 MB | 30 Oct |
| vercel 62.1 | 346 MB | 2 Oct |
| next 16.4 | 337 MB | 28 Oct |
| netlify-cli 27.16 | 276 MB | 30 Oct |
| vercel 59.1 | 236 MB | 1 Jun |
| wrangler (three copies) | 652 MB | Aug to Oct |
| react-doctor 0.7.7 (twice) | 330 MB | 14 Jul |
Deploy CLIs are the heavy ones. They pull in hundreds of dependencies, and npx keeps all of them.
Why the same tool is there three times
npx names each folder after a hash of the exact package text you typed. In npm's source (libnpmexec), it's the first 16 characters of a SHA-512 of the package names, sorted and joined. You can check it yourself:
$ printf '%s' vercel | shasum -a 512 | cut -c1-16 # 69f9afb961c37556 $ printf '%s' vercel@latest | shasum -a 512 | cut -c1-16 # 67eb4586ca667318
Both folders were in my _npx. npx vercel and npx vercel@latest run the same tool, but npx sees different text, so each gets its own full install. A third spelling, from a README that pinned a version, made the third copy. The same goes for react-doctor and react-doctor@latest, which left me two identical 165 MB installs.
Nothing removes the old ones. My npx vercel folder still held vercel 59.1, last touched on 1 June.
npm cache clean doesn't reach it
npm cache clean --force is the usual advice, and it only removes _cacache. In npm's source the command deletes join(npm.cache, '_cacache') and nothing else. On my Mac it would have freed 11 MB and left the 3.9 GB.
Clear it
On npm 11 and later, npm manages the folder itself. These were on npm 11.12.1:
$ npm cache npx ls # every entry, with its packages $ npm cache npx info 69f9afb961c37556 # one entry in detail $ npm cache npx rm 69f9afb961c37556 # remove one $ npm cache npx rm # remove them all
ls printed (unknown) for 24 of my 59 entries, ones that don't record what was asked for. npm cache npx info <key> still shows the packages inside.
On npm 10, npm cache npx fails with EUSAGE (my npm 10.9.8 did). Delete the folder instead:
$ npm --version $ rm -rf ~/.npm/_npx
Nothing outside _npx uses those folders. Your projects keep their own node_modules, and global installs (npm install -g) live elsewhere. The only cost is that the next npx of each tool downloads it again.
Don't remove it while an npx command is running, such as a dev server or an MCP server started with npx. Quit those first. Many AI tool setups start MCP servers this way, so check before you clear.
Keep it small
- Install the tools you use every day.
npm install -g vercelkeeps one copy, whichnpm update -gkeeps current. npx is for tools you run once. - Type the name the same way every time. Pick
npx vercelornpx vercel@latest, not both. - Clear it every few months. It only fills up again with what you actually use.
Browsers that npx downloads
Some tools you run with npx download more than packages. npx playwright install puts browsers in ~/Library/Caches/ms-playwright, outside _npx, and clearing npx leaves them. Mine held Chromium, Firefox and WebKit, 1.1 GB.

_npx folder yet, so use the commands above for that.To see every developer cache on your Mac side by side, _npx included, run diskreceipt, a free Terminal tool that only reads. For the rest of the JavaScript caches, see Delete node_modules safely.
Sources
- npm docs: npm cache
- npm docs: npm exec and npx
- npm's source on this Mac:
lib/commands/cache.js(clean deletes_cacacheonly) andlibnpmexec/lib/index.js(the folder hash). - Measured on this Mac on 1 November 2026 (npm 10.9.8 and 11.12.1):
du,npm cache npx ls,npm cache npx infoand the hash check above. Nothing was deleted.