NPM package installation is divided into local installation (locally), the global installation of two, from the command line to see, the difference is only G-only, such as:
-G GRUNT-CLI # Global Installation:
explained separately below.
1. When NPM installs Xxx-g, the module will be downloaded and installed into the global catalog.
The "Global Catalog" is set by the NPM config set prefix "directory path".
Use NPM config get prefix to get the current set of directories.
2. NPM Install XXX, download the module to the directory where the current command line is located.
For example:
C \123>npm Install XXX
will be installed to
C:\123\node_modules\xxx
This approach is obviously not good, so it is common to use the global installation of a unified installation of a directory, which is easy to manage, the structure is clear and can be reused.
Nodejs NPM Install differences between global and local installations