Node.js environment configuration

Press the [win+R] key on the keyboard, enter cmd, and press Enter to open the cmd window
insert image description here
insert image description here###### Environment configuration instructions:
Create two folders [node_global] and [node_cache] under the installed folder as follows picture:
insert image description here

After creating two empty folders, open the cmd command window and enter
npm config set prefix “G:\Node\node_global”
npm config set cache “G:\Node\node_cache”
insert image description here

Next, set the environment variable, close the cmd window, "My Computer" - right click - "Properties" - "Advanced System Settings" - "Advanced" - "Environment Variables" to enter the environment variable dialog box, and create a new
insert image description here
[ NODE_PATH], enter [G:\Nodejs\node_global\node_modules], modify [Path] under [User Variables] [G:\Nodejs\node_global]
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

6. After the test configuration, install a module for testing. We will install the most commonly used express module, open the cmd window, and enter the following command to install the module globally: npm install express -g # -g means global installation Switch
to
insert image description here
Taobao Mirror source: npm config set registry http://registry.npmmirror.com;
restore to the original official address command: npm config set registry https://registry.npmjs.org;
check whether the installation is successful: npm config get registry;

The command used in the terminal: get-ExecutionPolicy displays Restricted, indicating that it is unavailable.
Enter the command: set-ExecutionPolicy RemoteSigned
and use the get-ExecutionPolicy command to obtain: RemoteSigned

Guess you like

Origin blog.csdn.net/qq_46584697/article/details/131198407