NVM: Download, install and use node multi-version management
Uninstall node before use to avoid various weird problems that may lead to failure. Uninstall from win: win => Settings => Applications => Applications and Features, find node, click the uninstall button that appears and uninstall it.
1. Download and install:
https://github.com/coreybutler/nvm-windows/releases
Windows system downloads nvm-setup.zip or exe installation package
Or Alibaba Cloud Disk:
https://www.aliyundrive.com/s/NGLUQSBo5Hc
extraction code: je83
2. Set the source address
Win + R Enter cmd to open the command line:
or:
set up:
nvm node_mirror https://npmmirror.com/mirrors/node/
3. Install node
Currently, only the node management tool is installed, and there is no node, so it needs to be installed.
nvm isntall node version number
// 如:安装18.17.0 如安装其他的自行更换版本号
nvm install 18.17.0
nvm ls // 查看目前已经安装的版本
nvm install 18.17.0 // 安装指定的版本的nodejs
nvm use 18.17.0 // 使用指定版本的nodejs
nvm list available //显示可下载版本的部分列表
nvm uninstall 18.17.0 //删除已安装的指定版本,语法与install类似
nvm alias //给不同的版本号添加别名
nvm unalias //删除已定义的别名
`nvm reinstall-packages <version>` //在当前版本node环境下,重新全局安装指定版本号的npm包
nvm current //显示当前的版本
other:
1. nvm use command reports error
Use administrator powerShell or win + R to enter cmd to open (see step 2 for details: Set the source address)
2. The npm version does not exist
Node version problem. If there is no npm version, you need to manually copy the npm file to the corresponding folder.
Check the npm version corresponding to the problematic version
Change it to whatever version you want. Pay attention to two changes.
Open the Taobao npm repository: https://registry.npmmirror.com/-/binary/npm/v6.14.8/v6.14.8.zip
View the full version: https://registry.npmmirror.com/binary.html?path=npm
After downloading the zip package and decompressing it, rename the decompressed folder (similar to: cli-6.14.8) to npm
win + R enter: %APPDATA%\nvm
Open node_modules corresponding to the node version in the user's nvm folder
Copy npm, npm.cmd, npx, and npx.cmd in the bin directory of the renamed npm to a directory at the same level as the node_modules directory.
Test Results:
Before comparison:
This ends~~