NVM, short for Node Version Manager, is a command-line tool that allows you to quickly install and use different versions of node.js via the command line. You can easily switch node versions, and you can coexist with multiple versions of nodes.
NVM Linux Version:The hyperlink login is visible. NVM Windows Version:The hyperlink login is visible. NVM Windows Desktop Version:The hyperlink login is visible.
This article is mainly a demonstration of using NVM to install and manage Node versions on a Linux (ubuntu 22) server.
Installation
Install using the curl command, as follows:
Running the command downloads the script and runs it. The script clones the nvm repository to ~/.nvm and tries to add the source line from the code snippet below to the correct configuration file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.sour).
As shown below:
Verify the installation
To verify that NVM is installed, do the following:
nvm should output if the installation is successful. Note thiswhich nvm will not work, because itnvm is a source shell function, instead of executable binaries.
Note: On Linux, after running the installation script, if you receive or don't see any feedback from the terminal after typing command -v nvm, simply close the current terminal, open a new terminal, and try to verify again.
Download
NVM is downloaded from the node official website by default, and foreign servers are bound to be slow. NVM supports downloading packages from the mirror server, so we just need to add an environment variable NVM_NODEJS_ORG_MIRROR. The command is as follows:
As shown below:
Try to install the specified version with the following command:
(End)
|