I am not a newbie, but I am still confused with the way npm puts packages in node_modules.
So, what I can see is:
- My project's
dependenciesare installed intonode_modules. That's as expected. - Some other packages are installed into the project's
node_modulesas well, even if those packages are not within my project'sdependenciesordevDependencies. Okay, I assume that these are dependencies of my project's dependencies and hence, npm throws just every package to the project'snode_modules. - Now the most obscure part. Of those packages (from paragraph 2 above), some contain their own
node_modulesand packages inside it, but others do not containnode_modulesand store their dependencies in the project'snode_modules! The heck?
Why is that inconsistent behavior, why some sub-dependencies have their own node_modules and other sub-dependencies just drop their deps in the project's node_modules?