Node_Modules is huge! Is this normal?


#1

So I’ve recently tried getting into the Angular JS framework, which requires that I use npm scripts to compile my code into JavaScript. The problem is that just installing npm modules in a single project takes up like 47MB. I know that I’m supposed to add the node_modules folder to the .gitignore file so that I don’t actually upload that 47MB folder to Github. The problem is I still end up with a bunch of 47MB folders on my local computer if i keep installing npm_modules for every project.

What do I do? Is it normal for node_modules to be such a big folder?


#2

This is my Projects folder. There are like 70 small projects and maybe third have a node_modules folder (do the calculations :wink:) :


#3

Jesus. So do you just add 500 MB every time you start a new project? i’m trying to figure out what developers normally do.


#4

No, it’s total size of the whole Projects folder.
I counted and there are only 7 folders containing node_modules (I changed HDD recently). So each node_modules folder is 76MB in average.

i’m trying to figure out what developers normally do.


#5

Oh haha. Ok, that’s not nearly as bad. I guess I did nothing wrong when first installing NPM. I’ll just have to live with my projects now taking up a ridiculous amount of space compared to before.


#6

Be sure you are using v5 of npm (it’s much faster than v4) or you could try yarn.


#7

There’s a npm package called pkglink that can significantly reduce the size of your node_modules folders by hardlinking the packages.

Here’s how much space I saved after first using it:


#8

Looks promising, will definitely check out so I can reduce the space! Thank you!