Node16.xx decompression version installation

Node16.xx decompression version installation

1. Download the decompressed version of the Node installation package

Download address: http://nodejs.cn/

insert image description here

2. Unzip the Node installation package

Unzip the installation package in the installation directory (note: you can unzip it to your own defined directory as needed)
such as:D:\devenvironments\nodejs\node-v16.16.0

Create two folders at the same time

node_cache:npm缓存路径
node_global:npm全局安装路径

insert image description here

3. Configure environment variables

1. Right click 我的电脑--> 属性--> 高级系统设置--> 高级--> 环境变量
2. Create a new variable in the system variable Variable
name: NODE_HOME
variable value: D:\devenvironments\nodejs\node-v16.16.0(Node installation path)
3. Find the path variable and add variable value
%NODE_HOME%
%NODE_HOME%\node_global

4. Configure npm global path and cache path

Open the cmd command line tool as an administrator and execute
npm config set cache "D:\devenvironments\nodejs\node-v16.16.0\node_cache"
npm config set prefix "D:\devenvironments\nodejs\node-v16.16.0\node_global"

5. Verify that the installation is successful

cmd command line tool, execute node -v,npm -v

insert image description here

Note: If there is npm warn config global --global, --local are deprecated. use --location=global instead.an alarm, you need to modify the two files npm and npm.cmd (the installation path of Node)

insert image description here

Modify line 23 of the npm file to the style shown in the figure below, and the command is as follows:prefix --location=global

insert image description here

Modify line 12 of the npm.cmd file to the style shown below, and the command is as follows:prefix --location=global

insert image description here
At this point, reopen cmd, npm -vthere will be no error

Upgrade npm version:npm install -g npm

Guess you like

Origin blog.csdn.net/weixin_53313592/article/details/126450362
Recommended