How to clear global npx cache
Published on May 30, 2023
1 min read
Recently, I've seen myself running into the following message whenever I'm using a certain CLI tool with
1A new version of "x-package" is available2You can update by running: npm install -g x-package
I don't want to install the CLI tool globally and go into the rabbit hole of maintaining it as a dependency.
One way I've found that works on macOS to clear the global
1rm -rf ~/.npm/_npx
This will clear the global
npx cache and you'll be able to use the latest version of the CLI tool.
Also, you can add an alias to your
.bashrc file to make it easier to run:
1alias clearnpx="rm -rf ~/.npm/_npx"
If you've trouble finding where npm stores
npx cache on your system, run the following command to find out the exact path to the
1npm config get cache
Browse all posts