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 version2$ nvm install --lts // Install the latest LTS release3$ nvm install-latest-npm // Install latest NPM release only
List Available Releases
1$ nvm ls-remote2$ 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 version2$ nvm use --lts // Switch to the latest LTS version
Verifying NodeJS Version
1$ node -v2$ npm -v3$ nvm -v
Default to a NodeJS Version (Aliasing)
1$ nvm alias default <node_version> // Sets the default version on a shell2$ nvm alias <alias_name> <node_version> // Sets a user-defined alias to a versions34$ 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 version2$ nvm uninstall --lts // Uninstall the latest LTS release