Skip to content

why does NPM install extra modules?

twitter logo github logo ・1 min read  

I am new to web development, currently learning Node.js and Express is the first web framework i am diving into, since that's the stack the online course i am following work with (and i am quite happy with it).
While trying to to npm install Express to the directory i am working in, i have noticed that not only express module was install but also a bunch of other modules:


So, my questions is: What's the need for all those extra modules? and are they necessary for express to function well?

and Thanks in advance

twitter logo DISCUSS (8)
markdown guide


The reason for all of those extra modules is that Express depends on those. If you check out Express on NPM:

you can see the dependency list on the right side of the page matches those extra packages in your node_modules.

This is common for larger packages since it is much easier to find an existing package that solves a problem, rather than having to write it from scratch, similar to how you're using Express to simplify/abstract some things.

Also worth noting: Not only are the dependencies of Express installed, but also the dependencies of the dependencies, and that goes for every level until every needed package exists.

Hope this helps!


I couldn't find a simpler answer, you really explained everything I wanted to know and some more.
Thank you so much Connor


Even though it's so true, I'm still happy with it. I remember Ruby Dependency hell and it wasn't pretty..


I still think it could be better and people should think twice before including new dependencies

Especially when there's nested dependencies


Haha, but i suppose it's better that way, I'll get to look up a the dependencies of the module I'm installing and so I'll know that module better than if it included every thing itself.


Node installs all modules required by any modules you depend on. In the case of express. It has a number of modules that have to be pulled in to properly run.


Yes, so it seems! Cause I was wondering what are all these modules, am I doing something wrong, turns out npm installed what it's supposed to.
And that's why I love programming I learn something new every time I ask a question.
Thank you Joshua

Classic DEV Post from Nov 7 '19

What Are the Most Important CS Principles to Learn as a New Dev from a Non-Traditional Background?

Hamza profile image
I love learning.

Tip: You can configure your reading experience, such as using sans serif fonts.

Go to your the "misc." section of your settings.