Home  >  Q&A  >  body text

node.js - How to reference nodejs global module?

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?

PHP中文网PHP中文网2692 days ago706

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-06-05 11:14:53

    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 npm install... --save to locally install dependencies and automatically write them into dependencies / devDependencies

    when building the project.

    reply
    0
  • Cancelreply