When do I have to use npm cache clean
?
And, why after using npm cache clean
do I get info trying
?
info trying registry request attempt 1 at 09:54:07
http GET https://registry.npmjs.org/delayed-stream/latest
http 304 https://registry.npmjs.org/delayed-stream/latest
Npm caches packages into a directory (~/.npm
on Linux/OS X and %AppData%/npm-cache
on Windows).
This helps when you have multiple nodejs based setups requiring various packages as dependencies. Npm wouldn't download a package which is already in the cache, instead would use the package from the cache if it's already there. Hence, in this case, it tries to optimise on the number of downloads it has to do.
Now, about when do you use npm cache clean
. I've used it when for some reason my cache gets corrupted with some conflicting versions of different dependencies, or you simply want to clean up packages which you know you're not going to require at all, like maybe older versions of certain dependencies.
Basically, after using npm cache clean
, it's like having a fresh installation of nodejs/npm with the exception of node modules installed globally (those will stay until you until you remove them with the npm uninstall
command).
Additional info: https://docs.npmjs.com/cli/cache#configuration
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