We can install nvm, node version manager to achieve this. New version node v16, old version node v14
# npm -v 6.14.10
# node -v v14.15.4
Install and use
First uninstall node, find the node installation address where node
, find the directory and delete everything,
download nvm and install it successfully.
//安装版本
$ nvm -v
1.1.11
//查看可下载的版本
$ nvm list available
| CURRENT | LTS | OLD STABLE | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
| 20.5.0 | 18.17.0 | 0.12.18 | 0.11.16 |
//nvm install 版本号(例如:nvm install 14.15.4) 安装指定的版本的nodejs
$ nvm install 14.15.4
Downloading node.js version 14.15.4 (64-bit)...
Complete
Creating E:\install\nvm\temp
Downloading npm version 6.14.10... Complete
Installing npm v6.14.10...
Installation complete. If you want to use this version, type
nvm use 14.15.4
// 使用版本
$ nvm use 14.15.4
Now using node v14.15.4 (64-bit)
$ node -v
v14.15.4
$ npm -v
6.14.10
According to the actual installation path, E:\install\nvm\settings.txt
add below the installation pathnode_mirror和npm_mirror地址
root: E:\install\nvm
path: E:\install\nodejs
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/