Node.js installation and environment configuration.

This article is referenced from: https://www.cnblogs.com/liuqiyun/p/8133904.html

Step 1: Check how many operating systems your computer is based on (this machine is 64-bit); correspondingly download the 64-bit version of node.js.
Step 2: Download node URL: https://nodejs.org/ en/download/
Step 3: Operations after opening the website; the image below

Insert picture description here

Step 4: Install after downloading, double-click the installation package, and then operate, the following map

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Step 5: After the above installation is complete, you can test whether the installation is successful; open cmd and enter node -v to test whether the node is installed successfully; enter npm -v to test whether npm can be used; the image below

Insert picture description here

Step 6: The directory after installation is as shown in the figure below: The following image shows
here: the new version of Node.js has its own npm, and it will be installed when Node.js is installed. The role of npm is to rely on Node.js Package management can also be understood as what needs to be installed to install/uninstall Node.js

Insert picture description here

Step 7: Description: The environment configuration here mainly configures the path of the global module installed by npm and the path of the cache cache. The reason for this configuration is that it will be similar in the future: npm install express [-g] (below The optional parameter -g, g represents the meaning of global installation), the installed module will be installed in the path [C:\Users\Username\AppData\Roaming\npm], occupying the C drive space.
For example: I want to put the path of the full module and the cache path in the folder where I installed node.js, then create two folders [node_global] and [node_global] under my installed folder [D:\Develop\nodejs] node_cache] as shown below:

Insert picture description here

Step 8: Path transfer-------After creating two empty folders, open the cmd command window and enter
npm config set prefix "D:\Develop\nodejs\node_global"
npm config set cache "D:\ Develop\nodejs\node_cache"

Insert picture description here

Step 9: Next, set the environment variables, close the cmd window, "My Computer"-right click-"Properties"-"Advanced System Settings"-"Advanced"-"Environment Variables"

Insert picture description here

Step 10: Enter the environment variable dialog box, create a new [NODE_PATH] under [System Variables], enter [D:\Develop\nodejs\node_global\node_modules], and modify the [Path] under [User Variables] to [D: \Develop\nodejs\node_global】

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Step 11: Test
After configuration, install a module to test, we install the most commonly used express module, open the cmd window,
enter the following command to install the module globally: npm install express -g # -g is installed globally meaning

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43996999/article/details/96457780