What is the difference between the following:
npm cache clean
npm cache verify
Also what does the force option do?
It would be great if I could get an understanding specific to development on Windows platform.
clean: Delete all data out of the cache folder. Note that this is typically unnecessary, as npm's cache is self-healing and resistant to data corruption issues.
Clearing the cache will let you install the packages from npm again and have a fresh start.
npm cache clean --force. The clean command show above clears all the data present in your cache folder. To verify whether your cache is cleared or not, you need to use the below command.
Cache files are stored in ~/. npm on Posix, or %AppData%/npm-cache on Windows.
npm cache usually stored in the folder _cacache
which is located at C:\Users\<username>\AppData\Roaming\npm-cache\_cacache
This directory is a cacache-based content-addressable cache that stores all http request data as well as other package-related data.
when you run the command npm cache verify
, you can see this path along with other details.
ie; npm cache verify
: Verifies the contents of the cache folder, garbage collecting any unneeded data, and verifying the integrity of the cache index and all cached data.
npm cache clean --force
delete the entire cache. Please note, --force is a mandatory parameter, post npm v5. if you try to run npm cache clean
without --force
parameter, an error message will be shown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With