Skip to content

Instantly share code, notes, and snippets.

@AliMD
Last active November 26, 2023 15:27
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save AliMD/77bfcdc2f134005b76fe1db29b737d61 to your computer and use it in GitHub Desktop.
Save AliMD/77bfcdc2f134005b76fe1db29b737d61 to your computer and use it in GitHub Desktop.
Optimize NPM for faster installing packages

AliMd npm config

Optimize NPM for faster installing packages

Strong recommended

npm config set registry http://registry.npmjs.org/
npm config set loglevel info
npm config set fetch-retries 3
npm config set fetch-retry-mintimeout 15000
npm config set fetch-retry-maxtimeout 90000
npm config set cache-min 86400

The 86400 mean 1 day (24h * 60m * 60s) and you can change it to any other duration.

Recommended

change all d:\npm to your optional path
Remember to add d:\npm to you os PATH, its necessory for your global node modules

mkdir d:\npm
npm config set prefix d:\npm

mkdir d:\npm\cache
npm config set cache d:\npm\cache

You can keep or share you npm cache to prevent download it again ;)

@MostafaHassanzadeh
Copy link

Like

@CannibalKush
Copy link

This changed my life.

@yvie10
Copy link

yvie10 commented Oct 6, 2021

Great!

@amiresp
Copy link

amiresp commented Nov 26, 2023

Like

@AliMD
Copy link
Author

AliMD commented Nov 26, 2023

Like

این دیگه ارزشی نداره
مال خیلی وقت پیشه
الان فقط yarn 4 رو مد pnp

@amiresp
Copy link

amiresp commented Nov 26, 2023

npm config set cache-min 86400
not working in npm v10

@AliMD
Copy link
Author

AliMD commented Nov 26, 2023

npm config set cache-min 86400 not working in npm v10

میگم برو یارن ۴ گوش نمیدی

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment