Install multiple node versions at the same time

Official documentation of nvm: https://github.com/nvm-sh/nvm

If you want to install multiple different versions of nodejs on the same machine (computer), you need to use the nvm tool.

Reminder: Multiple different versions of nodejs can be installed on the machine at the same time, but only one of them can be used. You can use the command nvm use to switch between different versions of nodejs.

Proceed as follows:

  1. If node is already installed, please uninstall it first
  2. Download nvm and extract it to any directory
    https://github.com/coreybutler/nvm-windows/releases/tag/1.1.9

There will be a nvm-setup.exe program after decompression.
3. Double-click nvm-setup.exe
(1) Set the installation address of nvm, and then [Next].

insert image description here

(2) Set the installation address of node, and then [Next].

insert image description here

  1. Nvm has automatically set environment variables, check the nvm version

nvm -v
Running version 1.1.9.
insert image description here

  1. install nodejs

Installation syntax: nvm install []

  • version: node specific version
  • arch: The number of system bits, the default is 64 bits, if it is 32 bits, execute nvm install 32
    The following demonstrates the installation of nodejs v14.19.1 and v16.14.2 versions, my operating system is 64 bits.

nvm install 14.19.1
nvm install 16.14.2

  1. Switch nodejs version.
    The same machine can only use one version of nodejs at the same time. To use a different version, you need to use the nvm use command to switch.
    You can go to the nvm installation directory to see which versions of nodejs are currently installed.
    insert image description here

nvm use 14.19.1
Now using node v14.19.1 (64-bit)
node -v
v14.19.1

nvm use 16.14.2
Now using node v16.14.2 (64-bit)
node -v
v16.14.2

7nvm commonly used commands
nvm list View all Node versions on the machine
nvm uninstall version Delete the specified node version

Guess you like

Origin blog.csdn.net/weixin_45597928/article/details/128818319