The first time I "npm install" package_1, I get the following error.
npm ERR! path C:\Users\john_\Documents\GitHub\why_npm_nesting_fails\package_1\node_modules\.staging\bignumber.js-55edd243
I don't use "bignumber" so assume it's a MySQL dependency. The second time I "npm install" package_1, it passes.
added 2 packages and audited 30 packages in 0.722s
It has something to do with MySQL since after deleting this dependency everything works the first time.
Here is a diagram of the dependencies:
The stripped-down project can be found at https://github.com/johngrabner/why_npm_nesting_fails Only 4 package.json files with 7 lines each, including { } demonstrates this problem. ie: 4 files with 1 line each that demonstrates this issue.
This problem is stopping me from cleanly placing my project into docker containers since the first "npm install" fails. A workaround of installing "package_4", then installing "package_3" and so on, works but I fear I am not understanding something that will come back and bite me.
The above issue occurs on both Windows and Docker Node:9.4.