npm package installation is divided into two types: local installation (local) and global installation (global). Judging from the command line, the difference is only whether there is -g, such as:
[Global directory] Set via npm config set prefix "directory path".
Get the currently set directory through npm config get prefix.
2. npm install xxx downloads the module to the directory where the current command line is located.
For example:
This method is obviously not good, so the global installation method is generally used to install it in a unified directory, which is convenient for management, has a clear structure, and can be reused.