nvm(1)
Node Version Manager (nvm) allows you to install and switch between multiple versions of Node.js and npm.
Synopsis
nvm [COMMAND] [OPTIONS]Description
nvm is a bash script that manages Node.js versions on a per-user basis. It installs Node.js versions into isolated directories, letting you switch between them without affecting your system Node.js installation or other users' environments.
After installing nvm, new shell sessions automatically have access to the nvm command. You can install multiple Node versions, set a default version, and switch versions on-demand using simple commands.
Common options
| Flag | What it does |
|---|---|
install <VERSION> | Download and install a specific Node version (e.g., nvm install 18.0.0 or nvm install node for latest) |
use <VERSION> | Activate a Node version in the current shell session |
alias <NAME> <VERSION> | Create an alias for a Node version (e.g., nvm alias myproject 16.13.0) |
alias default <VERSION> | Set the default Node version for new shell sessions |
list | Show all installed Node versions; current version marked with arrow |
list-remote | List all available Node versions available for installation |
uninstall <VERSION> | Remove an installed Node version and its npm packages |
current | Display the currently active Node version |
run <VERSION> [ARGS] | Execute a command with a specific Node version without switching |
which <VERSION> | Show the path to an installed Node version's executable |
Examples
Download and install Node.js version 18.12.0
nvm install 18.12.0Install the latest stable version of Node.js
nvm install nodeActivate Node version 16.13.0 in the current shell session
nvm use 16.13.0Display all installed Node versions with the current one highlighted
nvm listSet Node 18.12.0 as the default version for all new shells
nvm alias default 18.12.0Run app.js using Node version 14.21.0 without switching versions
nvm run 14.21.0 app.jsRemove Node version 16.13.0 and all its associated npm packages
nvm uninstall 16.13.0Create a named alias 'production' for Node version 18.12.0
nvm alias production 18.12.0