Is there a way to configure NPM to first check my system for already downloaded packages/versions rather than always pull everything down from the internet? The bandwidth consumption is so huge for even the tiniest react or angular project. Is this what Yarn solves? I’ve searched online but all I see are thick documentation that don’t directly address the issue with specific steps to achieve my objective.
Asked
Active
Viewed 1,130 times
2
-
Why don't you try `npm-check` package. here is the link for it. https://www.npmjs.com/package/npm-check. After installing it, just type `npm-check` in your terminal. – Thananjaya S Apr 13 '18 at 10:16
-
I don’t actually want to check anything: I want NPM to check automatically by itself and only fetch from Internet when there is no local copy – user1729972 Apr 13 '18 at 15:44
1 Answers
3
Yes, there is. Simply type on terminal:
npm config set prefer-offline true
When you type npm install
it first checks downloaded packages. See documentation.

4ndt3s
- 3,238
- 2
- 20
- 30
-
Is there a -g needed or something? Recall when I NPM install for project 1 for instance, all stuff are in node_modules in project 1’s folder. When I now NPM install in project 2’s folder, how will it know to check the other folder for already downloaded stuff? Does it keep a copy of everything ever downloaded somewhere central? – user1729972 Apr 13 '18 at 15:46
-
The npm cached packages are global. To check where the cache is saved type `npm config get cache` on terminal. You don't need -g. – 4ndt3s Apr 13 '18 at 17:01