How to delete the localy installed version of npx command?
Asked Answered
K

1

12

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

Karleen answered 20/1, 2021 at 8:19 Comment(0)
D
13

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/
Dulcinea answered 8/9, 2022 at 18:39 Comment(4)
or on Windows, apparently at C:\Users\{YourUserName}\AppData\Local\npm-cache_npx\Dulcinea
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.Popover
Super handy, ty!Pringle
For Windows, the folder is different than what @Dulcinea posted. Maybe it's changed. On my system you have to go to the _npx subfolder. You can use this %localappdata%\npm-cache\_npxQuinonez

© 2022 - 2024 — McMap. All rights reserved.