Node.js Download and Installation Tutorial


Node.js download

1. Enter nodejs official website: https://nodejs.org/en
insert image description here
2. Click downloads
insert image description here3. Now slide the scroll bar, find and click previous release
insert image description here
4. On this page, select the required version (for example: Node.js 11.15.0)
insert image description here5. At this time, click release on the right side of the selected version
insert image description here

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
insert image description here
7. Download process
insert image description here

Node.js installation

1. Double-click the downloaded msi file
insert image description here

2. If the following warning pops up, click the [Run] button.
insert image description here
3. Click the [Next] button
insert image description here
. 4. Check to agree to the agreement, and click the [Next] button.
insert image description here
5. Set the installation path, and click the [Next] button.
insert image description here
6. Click the [next] button
insert image description here
7. Click the [next] button
insert image description here
8. Click the [install] button
insert image description here
9. Wait for the installation to complete
insert image description here
10. Click the [finish] button
insert image description here
11. Open cmd, enter node -v, npm -v, and it will appear The following interface is successfully installed

insert image description here

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.
insert image description here
Start cmd and enter:
insert image description hereIf 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).
insert image description here
insert image description here

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".

insert image description here
Run the test, start cmd, enter nodeto enter node, and then enter require('express'), the following interface appears and the configuration is successful
insert image description here

modify user variables

1. Open the environment variable setting window and edit the Path variable

insert image description here

2. Edit the .../npm variable to D:\sortware\nodejs\node_global
insert image description here

3. After the setting is complete, click the Confirm button
insert image description here

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

insert image description here
2. Replace the image with Taobao image

npm config set registry https://registry.npm.taobao.org/

insert image description here
3. Check whether the configuration is successful

npm config get registry

insert image description here

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
insert image description here
3. Execute the command to check whether cnpm is installed successfully

cnpm -v

insert image description here

Guess you like

Origin blog.csdn.net/m0_62617719/article/details/130423504