Back

NVM Commands Cheatsheet

Node Version Manager (NVM)

Node Version Manager (NVM) is a handy bash script to manage multiple active Node.js versions.

Install NVM with Brew

I find the easiest way to get started is with Brew.

1
$ brew install nvm

And every so often, it's handy to update Brew, as well as upgrading the installed brew packages.

1
$ brew update && brew upgrade && brew cleanup

Install a Version of NodeJS

1
$ nvm install <node_version> // Install a specific version
2
$ nvm install --lts // Install the latest LTS release
3
$ nvm install-latest-npm // Install latest NPM release only

List Available Releases

1
$ nvm ls-remote
2
$ nvm ls-remote | grep -i "latest"
3
$ nvm ls-remote | grep -i "<node_version>"

List Installed Versions

1
$ nvm ls

Switch to a Version

1
$ nvm use <node_version_or_alias> // Switch to a specific version
2
$ nvm use --lts // Switch to the latest LTS version

Verifying NodeJS Version

1
$ node -v
2
$ npm -v
3
$ nvm -v

Default to a NodeJS Version (Aliasing)

1
$ nvm alias default <node_version> // Sets the default version on a shell
2
$ nvm alias <alias_name> <node_version> // Sets a user-defined alias to a versions
3
4
$ nvm unalias <alias_name> // Deletes the alias named <alias_name>

Check the Path to the NodeJS Executable

1
$ nvm which <installed_node_version> // Path to a specific executable

Uninstall a Version of NodeJS

1
$ nvm uninstall <node_version> // Uninstall a specific version
2
$ nvm uninstall --lts // Uninstall the latest LTS release