How to change the cache path or location in Npm
Learn, how to change the default cache directory path or location in npm.
The default cache directory path is ~/.npm on Posix, or %AppData%/npm-cache on Windows.
Change the cache path
To change the cache path in npm, you need to run the following command by replacing it with your cache path.
Example for Windows users:
npm config set cache C:\Myapps\nodejs\cache --globalExample for Mac or Linux users:
npm config set cache ~/desktop/nodejs/cache --globalYou can also specify the cache folder path at the time of installing the npm package like this.
npm install date-fns --cache ~/Desktop/sealThis above command stores the cache inside the Desktop/seal folder.


