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.
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.
verify
option check the cache using a freshly downloaded checksum file, or does it use a local one? If it's a local one, I would expect the clean
option to be a safer option. Is there any scenario where the clean
option still make sense?
Jan 3, 2020 at 4:53