1. Download the installation package

  • Go to nodejs.cn/download and download a 64-bit free installation package, such as Node-v14.17.2-win-x64.zip
  • Decompression. For example, decompress to D:/Soft

2. Add global folder and cache folder configurations

  • Add the node_global and node_cache folders to the D:/Soft/node-v14.17.2-win-x64 folder

  • Open the system environment variable path
  • Add the following three items
D: \ Soft \ node - v14.17.2 - win - x64 D: \ Soft \ node - v14.17.2 - win - x64 \ node_global D: \ Soft \ node - v14.17.2 - win - x64 \ node_global \ node_modulesCopy the code

  • Open the CMD
  • Enter node -v and NPM -v to verify the installation

  • Use the following command to set the nodeJS global folder and cache folder
NPM config set prefix "D:\Soft\node-v14.17.2-win-x64\node_global" NPM config set cache "D: \ Soft \ node - v14.17.2 - win - x64 \ node_cache"Copy the code
  • Run the NPM config list command to check whether the configuration is successful

3. Install global package verification

NPM I -g http-server // Check whether the corresponding package file is generated in the node_global folderCopy the code