Article directory
Node.js download
1. Enter nodejs official website: https://nodejs.org/en
2. Click downloads
3. Now slide the scroll bar, find and click previous release
4. On this page, select the required version (for example: Node.js 11.15.0)
5. At this time, click release on the right side of the selected version
6. In this interface, select the required system and installation package form (for example: node-v11.15.0-x64.msi), and click this link to start downloading
7. Download process
Node.js installation
1. Double-click the downloaded msi file
2. If the following warning pops up, click the [Run] button.
3. Click the [Next] button
. 4. Check to agree to the agreement, and click the [Next] button.
5. Set the installation path, and click the [Next] button.
6. Click the [next] button
7. Click the [next] button
8. Click the [install] button
9. Wait for the installation to complete
10. Click the [finish] button
11. Open cmd, enter node -v, npm -v, and it will appear The following interface is successfully installed
npm configuration
First configure the storage path of the npm global module and the path of the cache, and create two folders "node_global" and "node_cache" under NodeJs.
Start cmd and enter:
If you do not set this step, the global installation package of npm will not be in the node installation folder.
npm config set prefix "D:\Software\nodejs\node_global"
npm config set cache "D:\Software\nodejs\node_cache"
Now let’s try to install a module. In the cmd command line, enter npm install express -g
(the "-g" parameter means to install it in the global directory, which is the "D:\Software\nodejs\node_global" set above).
Configure node_path
Enter the environment variable dialog box, create a new "NODE_PATH" under the system variable, and enter "D:\Software\nodejs\node_global\node_modules".
Run the test, start cmd, enter node
to enter node, and then enter require('express')
, the following interface appears and the configuration is successful
modify user variables
1. Open the environment variable setting window and edit the Path variable
2. Edit the .../npm variable to D:\sortware\nodejs\node_global
3. After the setting is complete, click the Confirm button
Replace the npm source with the Taobao image
Start cmd and enter the following command
1. View the initial npm source, as shown in the figure:
npm config get registry
2. Replace the image with Taobao image
npm config set registry https://registry.npm.taobao.org/
3. Check whether the configuration is successful
npm config get registry
Global installation of cnpm based on Taobao source
1. Globally install cnpm based on Taobao source
npm install [email protected] -g
2. After downloading, we can see the cnpm module locally
3. Execute the command to check whether cnpm is installed successfully
cnpm -v