Download Node.js

Node.js can be downloaded at nodejs.org/en/download…

Select the **Windows binaries (.zip)** version to download and choose the 64-bit or 32-bit version suitable for your computer configuration.

2. Configure the NPM installation directory

The new version of Node.js comes with NPM, which can be found in node_modules. NPM is used to manage node.js dependent packages, similar to Maven

Note:

After downloading.zip package, create two folders in the decompressed file path: Node-global (NPM global installation location) and Node-cache (NPM cache location), as shown below:

3. Configure environment variables

Add the node.exe directory and node_global to the environment variable. Create a new environment variable and set the directory of Node.exe to its value.

  1. Variable name:NODE_PATH, the value of the variable is the directory in which you installed Node.js, such as:F: \ Node. Js \ Node - v14.17.5
  2. Find the system variablePathVariable, double-click to edit, will%NODE_PATH%and%NODE_PATH%\node_globalAdd to a variable

Inspection and testing

The installation is complete. You can use NPM -v and node -v on the CMD command line to test whether the installation is successful.

Configure the global installation and cache paths

Run the CMD command to set the previously created node_global and node_cache paths to global installation and cache paths, respectively

NPM config set prefix "node-global path" NPM config set cache "node-cache path"Copy the code

Such as:

NPM config set prefix "F:\ node.js \node-v14.17.5\node_global" NPM config set cache" F:\ node.js \node-v14.17.5\node_cache"Copy the code

Six, set up warehouse

Large companies usually have a separate warehouse, with a command to set up the warehouse. Independent development can set up taobao warehouse, but also to ensure the download speed in the future.

 npm config set registry http://registry.npm.taobao.org/
Copy the code

After the installation and configuration is complete, you can use the following command to view the configuration information of NPM.

 npm config ls
Copy the code

Bode.js Windows binary For more details, please pay attention to other relevant articles in this site!