How does npm have all the dependencies of the project's package.json under the install subdirectory at one time?

< H2 > I believe that many people will have the same needs as me < / H2 >

the directory is as follows

Project

node_modules
package.json
subproject

node_modules
package.json

I cd to the first-level directory of the project
then npm install , I can only install all the dependencies of the first-level directory
how to implement the first-level directory install automatically let the subproject also Install all its package.json dependencies


generally few people have this requirement, and the subproject is generally declared as a submodule to the dependency of the main project. (relying on supporting local paths)
or you can write a shell script and execute it.


this kind of previous project nesting requirements is very strange. As mentioned above, it is a good choice to declare sub-projects to the main project in the form of components . If the dependency is not particularly high, you can even consider stripping it out to form a new project and then develop it independently.


Hello, I also have a project written in this way. Have you solved it?


check out this article
https://zhuanlan.zhihu.com/p/...

Menu