Install gnvm
Must read instructions before installation
- It is recommended
先安装gnvm
to install node.js and npm through gnvm later. If node.js is already installed, be sure to uninstall it first and clear the environment variables. - Open cmd input before installation
gnvm version
. If the version number is not displayed, it means that gnvm has not been installed and start the installation.
Step 1: Download gnvm
- It is recommended to download through curl, copy it to the browser and download it directly, that is
https://github.com/Kenshin/gnvm-bin/blob/master/64-bit/gnvm.exe?raw=true -o gnvm.exe
- You can also download what I have uploaded through Baidu Netdisk, the extraction code is 1205.
https://pan.baidu.com/s/10L2F5X734EUEaow0vtOVAw?pwd=1205
Other download methods
-
32-bit | 64-bit backup address, Baidu network disk, fast speed
-
For users who have installed go, use
-
go get github.com/Kenshin/gnvm
-
For users who have installed git, use
-
gitclone [email protected]:Kenshin/gnvm-bin.git
-
For users who have curl installed, use
-
curl -L
https://github.com/Kenshin/gnvm-bin/blob/master/32-bit/gnvm.exe?raw=true -o gnvm.exe
-
curl -L
https://github.com/Kenshin/gnvm-bin/blob/master/64-bit/gnvm.exe?raw=true -o gnvm.exe
Step 2: Configure gnvm environment variables (prerequisite: no Node.js environment)
-
Download and unzip gnvm.exe, save it to any folder (the path must not be in Chinese), and add this folder to the environment variable Path
-
My path is
D:\NodeJsNew
-
Add environment variables below
Win 11:
电脑-右键-属性-高级系统设置-环境变量-系统变量-Path-编辑-新建
-
To configure environment variables, please refer to Win11 Configuring Environment Variables
-
You can also add user variables
Step 3: Verify
desktop
Win+R
enter
cmd
Enter command
gnvm version
-
出现此页面即安装成功
Install Node.js
desktop
Win+R
enter
cmd
设置淘宝镜像(加速下载)
gnvm config registry TAOBAO
下载node.js(以16.20.0版本为例子)
gnvm install 16.20.0
查看当前node.js版本
node -v
查看所有node.js版本 (绿色的为当前使用版本)
gnvm ls
切换node.js版本 (切换18.15.0)
gnvm use 18.15.0
Install npm
First of all, the versions of npm and node match. If they do not match, an error may occur. When downloading, do not download a too high version (node), nor a too low version. Version reference
下载相匹配的版本(global默认指定匹配版本)
gnvm npm global
验证版本
npm -v
At this point, gnvm, node.js, and npm are all installed. This is only recorded for future reference.