Using npm config to modify cache location, featuring a sample npmrc file

22 December 2014

As usual, the internet isn't always 100% up to date.

Looking into the use of npm config, the documentation states that the global npmrc file lives in $PREFIX/npmrc - however, when you actually look for it, you'll find that it actually lives in $PREFIX/etc/npmrc

You can find the value of $PREFIX by running:

npm get config prefix

On Windows, this'll be in your user's AppData folder, normally.

So if you're looking to modify where npm throws cache data, you can run the following:

npm config set cache C:\myfolder\npm-cache --global 

As I couldn't find a sample npmrc file online in about a minutes worth of Google, I figured it would be worth posting what the contents look like as well:


Of course, there'll come a time when this post is out of date too - but hopefully that won't be for a while yet!

Tags: npm, npm-cache

Add a Comment

No Comments