How to reference nodejs global module?
Let’s talk about the scenario. I have a project A. When building it, the modules are installed globally. Then a new project B was created. Project B also needs to reference modules, and there are many applied modules.
How to quickly install the dependencies required for the project without manually modifying dependencies?
According to what you mean, I understand that all the dependencies required for project B have been installed when building project A, and are they installed globally? In this case, for you, project B does not need to install dependencies anymore. You can just reference them directly in your code. Dependencies are searched layer by layer until they are global. However, this way of writing is extremely not recommended. , it will be particularly troublesome when your project requires multiple people to develop and maintain. I personally recommend using
when building the project.npm install... --save
to locally install dependencies and automatically write them intodependencies / devDependencies