Node multi-version management (clear and clear)

overview

I recently learned about the cloud project, and the front end uses technologies such as vue3 + ts. When starting the vue3 project, a higher node version (16.15.0) is required, but I don’t want to uninstall the original version. At this time, node multi-version management is required. According to the project The method provided by the official document is recorded here .

1. Install nvm

windows install nvm

  1. You need to uninstall the locally installed Node.js first, and then download nvm , address:
    https://github.com/coreybutler/nvm-windows/releases

  2. In general, find the latest version, and then download the nvm-setup.exe file . After downloading, we can double-click to install it.

  3. We use PowerShell to open the command line. It should be noted here that PowerShell must be opened as an administrator , as follows:
    insert image description here

  4. Command nvm version, you can view the version number , as follows
    insert image description here

linux install nvm

  1. In the Linux warehouse of nvm, there are corresponding tutorials , warehouse address: https://github.com/nvm-sh/nvm
  2. Installing nvm is very simple, just execute the following command
# 下载并执行安装脚本
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# 使nvm命令生效
source ~/.bashrc
  1. The nvm command on linux is somewhat different from that on windows, but the basic usage is the same . You can check the instructions on github for details, so I won’t introduce it here.

2. Install nodejs

After we have installed nvm, install Node.js through nvm , as follows:

  1. To view the list of available versions of Node.js , execute the following command:
nvm ls available

insert image description here

  1. To install Node.js with version number 16.15.0 , execute the following command:
nvm install 16.15.0
  1. To view the installed version number , execute the following command:
nvm list

insert image description here

  1. To switch the version number to 16.15.0 (specify your own version number) , you can execute the following command:
nvm use 16.15.0
  1. To view the current version number of Node.js , execute the following command:
node -v
  1. To uninstall Node.js whose version number is 16.15.0 (specify your own version number) , you can execute the following command:
nvm uninstall 16.15.0

Guess you like

Origin blog.csdn.net/qq_44697754/article/details/128915818