LinuxCommandLibrary

nvm

Manage multiple Node.js versions

TLDR

Install a specific version of Node.js

$ nvm install [node_version]
copy

Use a specific version of Node.js in the current shell
$ nvm use [node_version]
copy

Set the default Node.js version
$ nvm alias default [node_version]
copy

List all available Node.js versions and highlight the default one
$ nvm list
copy

Uninstall a given Node.js version
$ nvm uninstall [node_version]
copy

Launch the REPL of a specific version of Node.js
$ nvm run [node_version] --version
copy

Execute a script in a specific version of Node.js
$ nvm exec [node_version] node [app.js]
copy

SYNOPSIS

nvm <command> [<arguments>]
Common commands:
nvm install <version>
nvm use <version>
nvm ls [<remote|installed>]
nvm alias <name> <version>
nvm uninstall <version>

PARAMETERS

install
    Installs a specified Node.js version (e.g., 18.17.1, lts/gallium, node).

use
    Switches to and uses the specified Node.js version in the current shell.

ls
    Lists all Node.js versions installed by nvm.

ls-remote
    Lists all available Node.js versions for remote installation.

alias
    Creates or manages aliases for installed Node.js versions (e.g., default, lts).

uninstall
    Removes an installed Node.js version from your system.

current
    Displays the currently active Node.js version managed by nvm.

which
    Shows the path to the Node.js executable for a given version.

run