Install multiple node versions on one computer

Sometimes running different projects may switch node versions, so multiple node versions may need to be installed on the computer.
1. The method adopted is to use the NVM node version switching tool
Note: Before this, delete the installed node files, and pay attention to whether there are any node-related files that have not been deleted.
After entering the official website, click the following item: Download

insert image description here
After downloading, click on the file, follow the steps and click Next to install.

Common commands of nvm:

//查看下载的已有的node版本
nvm list
//使用nvm下载node
nvm install node版本号
//例如:
nvm install 16.18.1
//查看nvm安装的版本
nvm -v
//切换node版本(这里以16.18.1为例)
nvm use 16.18.1
//可以查看当前可下载的node版本
nvm list available

If using nvm install to install node is too slow, you can switch to Taobao mirror to download:
add the following two lines to settings.txt in the root directory of nvm installation:

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

If the version of node that can be downloaded is too high, and there is no node of a lower version that can be downloaded, you can choose the following solutions:

1. Download the compressed package on the nodejs official website
insert image description here
insert image description here
. 2. After downloading, unzip it to the root directory of nvm, and name it the same as the node folder you downloaded before v版本号.
3. Then use nvm listview to find the old version of node.

If there is node -van invalid situation, the solution:
1. Create an empty folder in the nvm root directory nodejs
2. Configure environment variables:
insert image description here
run node -v and the current node version will be displayed.

Guess you like

Origin blog.csdn.net/weixin_45534301/article/details/131873067