What do I do? Is it normal for node_modules to be such a big folder?
This is my Projects folder. There are like 70 small projects and maybe third have a
node_modules folder (do the calculations ) :
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.
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.
Be sure you are using v5 of npm (it’s much faster than v4) or you could try yarn.
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:
Looks promising, will definitely check out so I can reduce the space! Thank you!
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.
The size of node_modules is the source of many memes. Yes, this is normal. Is it good? No. But it’s the state of Node development right now.
When I’m developing, I tend to install with the
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.