nvm
is a Node.js version manager that allows users to run multiple versions of Node.js on the same machine. Below are some commonly used nvm
commands and their usage:
-
nvm install <version>
: Installs the specified version of Node.js. For example, to install Node.js version 14.17.0, run the following command:1
nvm install 14.17.0
-
nvm use <version>
: Switches to the specified version of Node.js. For instance, to use Node.js version 14.17.0, run:1
nvm use 14.17.0
-
nvm ls
: Lists all currently installed Node.js versions. -
nvm ls-remote
: Displays all available Node.js versions. -
nvm uninstall <version>
: Uninstalls the specified version of Node.js. -
nvm alias <name> <version>
: Creates an alias for a specified version. For example, to create an aliasdefault
for Node.js version 14.17.0, use the command:1
nvm alias default 14.17.0
After running this command, the Node.js version with the alias
default
will be automatically used each time you open a terminal. -
nvm current
: Shows the version number of the currently active Node.js. -
nvm version
: Displays the currently installed version of nvm.
These are some of the commonly used nvm
commands and their functionalities. You can run nvm --help
or check the nvm
documentation for more information.