current position:Home>Node under windows JS installation detailed steps tutorial

Node under windows JS installation detailed steps tutorial

2022-04-29 12:47:54ty_ xiumud

Node Download and install of

Node.js Official website download :https://nodejs.org/en/download/
 Insert picture description here
All the way fool installation can . After that, you need to make some settings . Be careful Your installation here is generally not in C Disk mounted . If you choose to install C disc , Subsequent operations can also be simplified a lot , But not recommended .
After installation, open the command line tool (Win+r Then output cmd that will do ) Use
 Insert picture description here

node -v
npm -v

 Insert picture description here
It shows your corresponding version , Can verify successful installation

Other configuration

0, Environmental description and preparation

Here the author's installation directory is as follows E:\nodejs
Create two new folders under the installation directory node_global And node_cache
These two folders are used to store the location of your subsequent downloaded packages and the location of cache files .

1, System variable Settings

Set your environment variables
 Insert picture description here
Open the direct search environment variable , Open the can .

In your system environment variables Path add to

E:\nodejs
E:\nodejs\node_modules
 Insert picture description here

Add... To your user variable NODE_PATH

NODE_PATH The address is as follows E:\nodejs\node_modules
 Insert picture description here

User environment variable Path Add

E:\nodejs\node_global
E:\nodejs\node_modules\npm
that will do .
 Insert picture description here
Collection blog , Restart the computer , Make sure your environment is effective .

Place the downloaded package in your installation directory

Set global directory and cache directory , After creating two empty folders , open cmd Command window , Input

npm config set prefix "E:\nodejs\node_global"
npm config set cache "E:\nodejs\node_cache"

Check that the initial configuration has been modified

npm config list

 Insert picture description here
Indicates that the modification has been successful .

verification

Then test and install a package , See if it will be downloaded in the directory you specify ( It's your node_gloal Under the table of contents )
Note that you need to open the command line with the Administrator

npm install webpack -g

 Insert picture description here
Open the following directory , Check whether your package is installed in this directory

E:\nodejs\node_global\node_modules

Source change ( solve npm Slow download problem )

First of all to see npm Download path for npm config get registry
Output is https://registry.npmjs.org/ The explanation is from abroad npm Downloaded from the official website server
Use

npm config set registry "https://registry.npmmirror.com/"

This website is the new Taobao npm The address of the image source , If it fails in the future, you can baidu npm Slow download problem , Find a new mirror website .
See the output below
 Insert picture description here
The source change part refers to

copyright notice
author[ty_ xiumud],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204291120515172.html

Random recommended