Who can explain the difference between the global installation and the local installation in node.js?

  node.js, question

What are the advantages of each?

To put it simply:

The global installation is installed in nodejs’s installation directory, and the bin directory over there is in your path, so you can easily call the tools there directly from the command line.
The local installation is installed in the node_modules of the directory where package.json exists, which is found locally. It is used to build local projects (or to support nodejs operation, which can be directly referenced by require).

The two goals are completely separated. The local service for the project, the global is as a tool.

General common global are:

The most interesting thing is babel
In the past, the whole situation was taken into consideration.
Now it is suggested to be local