NVM Commands Cheat Sheet

NVM Commands Cheat Sheet

Photo by Ana Cruz on Unsplash

I keep forgetting these most common commands.

Install

Follow the official guide here. For mac with brew

brew install nvm

List Available Releases


nvm ls-remote
nvm ls-remote | grep -i "latest"
nvm ls-remote | grep i "<node_version>"

Install a node version

nvm install <node_version>

List installed versions

nvm ls

Aliasing

  • Set a specific version as default
nvm alias default <node_version>
  • Set a user defined alias to a node version
nvm alias <alias_name> <node_version>
  • Remove the alias name
nvm unalias <alias_name>

Switch to a version (Use)

# don't have to match exact number. `nvm use 16`  
nvm use <node_version> 
nvm use --lts # latest

Get path to installed node

# /Users/pratikthapa/.nvm/versions/node/v20.10.0/bin/node
nvm which node

Uninstall a version of NodeJs

nvm uninstall <node_version> # a specific version
nvm uninstall --lts # Uninstall the latest LTS release

Help

nvm --help # get help documentss