Code Eagle
Code Eagle

Reputation: 1222

Node modules size?

I really can't understand what really happens when i run this command in my terminal npm install, after few seconds i find node_modules folder with a size of at least 150MB or far bigger sometimes.

This is too much for my network capacity, When i download a movie for example, this doesn't happen in that speed, so i need to understand what is really happening when i run this command.

Do i really download a 150MB or more files size, or npm just download small files and do some work that makes it that big!

Upvotes: 1

Views: 6451

Answers (2)

Trott
Trott

Reputation: 70075

If you've run npm install previously (even in another folder/directory), subsequent npm install runs can get some/many/all packages from a local cache. From https://docs.npmjs.com/cli-commands/cache.html:

npm stores cache data in an opaque directory within the configured cache, named _cacache. This directory is a cacache-based content-addressable cache that stores all http request data as well as other package-related data. This directory is primarily accessed through pacote, the library responsible for all package fetching as of npm@5.

If you want to force npm to go over the network so you can compare performance, remove your node_modules directory, run npm cache clear, and then do npm install.

Upvotes: 2

mikemykhaylov
mikemykhaylov

Reputation: 99

As I understand it, it downloads all that data fully, no post-processing. It does however link the dependencies, so the final size might be a bit larger.

Upvotes: 1

Related Questions