1. Download the installation file from nodejs website. I installed the version node-v10.15.0-x64.msi.

2. After the installation is complete, you can check the relevant directory, which contains a node_modules directory and node execution file.

The path of the global module installed by NPM and the path of the cache cache are mainly configured. The reason for setting the environment variable is that the following operations will be performed in the future: NPM Install Express [-g] (optional -g, g indicates the global installation), the installed module will be installed in the [C: Users\ User name \AppData\Roaming\ NPM] path, occupy disk C space. For example, if I want to place the entire module path and cache path in my node.js installation folder, then in my installation folder [D:\tools\nodejs], I need to create two folders [node_global] and [node_cache]

After creating the two empty folders, open a CMD command window and type

npm config set prefix "D:\tools\nodejs\node_global" npm config set cache "D:\tools\nodejs\node_cache"

In the environment variable, change the default user variable NPM to D:\tools\nodejs\node_global, set it to the specified directory, and add NODE_PATH to the system variable. The value of D: \ tools \ nodejs \ node_global \ node_modules

 

 

 

After setting, you can view the environment variables and corresponding Node version number in DOS.

D:\tools\nodejs\node_global\node_modules\pdman D:\tools\nodejs\node_global\node_modules\pdman

In the folder CMD, go to DOS, execute NPM install