Let's say I have a project with a dependency, A.
A has its own dependency on B.
If I npm install A into my project, my node_modules folder looks like the following. Note that B has been installed as a top level module:
/myproject
/node_modules
/A
/B
Then if I were to depend on myproject from anotherproject, my node_modules folder looks like this:
/anotherproject
/node_modules
/myproject
/A
/B
But, if I were to install myproject as a global module npm install -g myproject, the node_modules folder ends up looking like this (no top-level B):
/myproject
/node_modules
/A
Why is this?
(npm 6.14.4}