Installation and simple use of NVM version manager for Node.js learning (NVM)

NVM is a very good version manager for node.js, you can switch node version, upgrade, etc. at will.

Github address: https://github.com/nvm-sh/nvm

The introduction of nvm on Github is very detailed. I won't go into details here. Start the installation directly.

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash

 OK, wait for the installation to complete.

To check whether the installation is successful, use the following command.

command -v nvm

If nvm is printed out, the installation is successful. Pay special attention here. After the installation is complete, there is a prompt as shown below

This means that the command window needs to be restarted. You can use the nvm command. If after the installation is complete, there is no response after entering the verification command above, then the command window needs to be restarted.

Here is a brief introduction to how to use it:

1. If we install:

nvm install node # 安装最新的node版本

vnm install 6.14.4 # 安装指定的版本

2. View and list all available versions:

nvm ls-remote

Will help us to list the available versions from the initial version to V15

3. If we want to check the installed version of this machine

nvm ls

As you can see, I did not install any version here.

In the above command, when we checked the installable version, we found that some versions will be followed by the words Lastest LTS in green. This wording means that this version is a long-term maintenance version of Node. In a production environment, it is best to use a long-term maintainable version as much as possible.

Below we use the command to install it, version 14.15.1.

nvm install 14.15.1

After the installation is complete, we are looking at the installation list

As you can see, I installed it correctly here.

We can also enter nvm directly on the command line to get many command line parameters of nvm.

Everyone can go down and learn common sense on their own.

Or, we enter nvm on the command line and press TAB.

The commands supported by nvm will be listed for us, which is equivalent to automatic code prompt, which is also very convenient.

Well, the above is the installation and simple use of NVM.

That's it for today. Thank you all for reading. Thank you.

Guess you like

Origin blog.csdn.net/u012798683/article/details/109900909