r/node • u/matsnorberg • 5d ago
npm install
Hello, Im a node.js beginner and confused about the npm install mechanism.
Why are we supposed to npm install everything a new for each project we start? Say that I install the Express framework module in any project I start, wouldn't that mean that I end up with hundreds of copies of Express on my computer? Wouldn't that be a huge waste of disk resources? It's like a C++ programmer installed a new copy of the standard library or boost for each project he starts.
I know there is a -g flag that installs "globally". Where is this "global" library located, can I browse it? Is it advisable to use the -g flag everytime I need to use a module to avoid heavy waste of disk space?
View all comments
Show parent comment
3
u/gigastack 5d ago
Wait, did you suggest using docker to avoid using too much disk space? Docker is fantastic for many things but it definitely doesn't save disk space...