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?
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.
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.
You should check out nodx, it’s a real-time dependency resolver, it only extracts the files your script needs, and it keeps the files in a root directory, so no more duplicate files/dependencies.
When I’m developing, I tend to install with the -g (or global) flag. If I am using the package in multiple projects, it will look first in the global repository before adding to the local one.
That said, for each build, yeah - you’d end up with a sizeable node_modules.