It is very easy to download and install nodejs on a windows computer. Refer to the graphic tutorial below, and you will be able to download and install it quickly.
1. Download nodejs
Download address: https://nodejs.org/en/download/
2. Install nodejs
Click on the installation package, all the way to the next step
3. Verify whether the installation is successful
The installation is successful, test whether the installation is successful, run CMD, and enter node -v and npm -v respectively to view the version numbers of node and npm
Supplement: Change the path when installing global modules and the path of the cache cache (not required)
question:
When executing commands such as npm install express -g for global installation, the module will be installed by default in npm and npm_cache under the C:Users username AppDataRoaming path, which is inconvenient to manage and takes up space on the C drive.
solve:
Configure the custom global module installation directory by yourself, and create two folders node_global and node_cache under the node.js installation directory , as shown in the figure:
cmd to execute the command:
npm config set prefix “D:Program Files odejs ode_global”
npm config set cache “D:Program Files odejs ode_cache”
Configure environment variables
After execution, configure the environment variables as follows:
" Environment Variables " -> " System Variables ": create a new variable named "NODE_PATH ", the value is " D:Program Files odejs ode_global ode_modules ",
" Environment Variables " -> " User Variables ": Edit the Path in the user variable , and change the path of the corresponding npm (" C:Users username AppDataRoaming pm ") to: " D:Program Files odejs ode_global "