8

When I execute a command with npx, npx propose me to install a version locally.

Example

npx matcha-stock -s=MSFT

If the version is updated on npm.org, npx gives me only the version installed locally and doesn't check if an updated version exists.

If I execute

npx matcha-stock@latest -s=MSFT

I get the latest version of the tool.

But, if I execute again

npx matcha-stock -s=MSFT

I got the previous installation.

Question: How to uninstall, clear the cache of the locally installed version of the command ?

#npx #NPM

Raphael Mansuy
  • 213
  • 1
  • 4
  • 10

1 Answers1

10

The dependencies of each of these commands are stored in a cache at .npm/_npx/*/node_modules, when I tried blowing all those away it worked.

Finding which one to delete

ls ~/.npm/_npx/*/node_modules | grep matcha-stock

Just deleting them all

rm -r ~/.npm/_npx/
Thomas
  • 6,515
  • 1
  • 31
  • 47
  • 1
    or on Windows, apparently at C:\Users\{YourUserName}\AppData\Local\npm-cache\_npx\ – Thomas Sep 08 '22 at 18:40
  • in the `_npx` sub folder the packages are stored in a folders using random id as their names. If you want to delete a specific package. then you can navigate to each folder and check the package.json and find out which package you are currently looking at. – Arjun Nayak Feb 24 '23 at 23:37
  • Super handy, ty! – Kraken Aug 08 '23 at 12:29