Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm cache clean v/s npm cache verify

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.

like image 464
copenndthagen Avatar asked Mar 14 '19 08:03

copenndthagen


People also ask

Is it safe to clean npm cache?

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.

What happens when you clean npm cache?

Clearing the cache will let you install the packages from npm again and have a fresh start.

What is npm cache clean -- force?

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.

Where is my npm cache?

Cache files are stored in ~/. npm on Posix, or %AppData%/npm-cache on Windows.


1 Answers

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.

npm cache verify

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.

like image 155
Jacob Nelson Avatar answered Sep 27 '22 23:09

Jacob Nelson