I even feel that this Package Manager is one of the most important reasons why JavaScript has been so successful over the past few years.

When Facebook released Yarn, the JavaScript community roared with joy, because Yarn offers amazing installation speeds. In addition, Yarn caches the installed Module locally on your computer, so the subsequent installation will be faster.

 

In fact, NPM has a similar function, but it has long been neglected by many people.

Like Yarn, NPM has a built-in caching mechanism that makes subsequent installation super fast.

Please look at:

 

Pretty fast, huh? It’s always been there, but it’s turned off by default.

How do I turn on NPM cache

npm config set cache-min 9999999
Copy the code

It’s that easy.

Now you can install the package as before:

npm install express
Copy the code

You can use this REPO to test the speed.

Of course, Yarn’s advantages go beyond speed; it also has some excellent features, such as continuous installation. But if speed is all you need, you can give NPM another chance, this time turning on its caching feature.



The original article:
npm cache: the unsung hero


Translation: the SDK. Cn


Author: Lu Xingyun


Disclaimer:

  1. Sdk.cn follows industry norms, all reprinted articles are authorized with the consent of the author and clearly marked with the source and link.
  2. We very respect the original author’s efforts, this site prohibits second reprint if need reprint please contact the original author.
  3. The original article reprinted by SDK.cn shall indicate the author, link and “source: sdK.cn” and keep the integrity of the article and title shall not be modified without the consent of the author.
  4. Authors’ contributions may be modified or supplemented as appropriate by sdK.cn.