When we install a package using the npm install <package-name>
command, npm stores the cache inside the user file system.
The default cache directory is ~/.npm
on Posix (mac or linux), or %AppData%/npm-cache
on Windows.
To see the right path of %AppData% in windows, you can use the set command (in the console with cmd ) to have a list of Environment variable. Then look for “APPDATA” variable. ( APPDATA = C:\Users\ngubri\AppData\Roaming ) .
Clearing the cache
To clear a cache in npm, we need to run the npm cache clean --force
command in our terminal.
npm cache clean --force
clean: It deletes the all data from your cache folder.
You can also verify the cache, by running the following command.
npm cache verify