DEV Community

Pratik Thapa
Pratik Thapa

Posted on

NVM Commands Cheat Sheet

I keep forgetting these commands. So, let's put is all together.

Installing

  • Follow installation steps:

nvm-sh/nvm

List Available Releases


nvm ls-remote
nvm ls-remote | grep -i "latest"
nvm ls-remote | grep i "<node_version>"
Enter fullscreen mode Exit fullscreen mode

Install a Node Version

nvm install <node_version>
Enter fullscreen mode Exit fullscreen mode

List Installed Versions

nvm ls
Enter fullscreen mode Exit fullscreen mode

Aliasing

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

Switch to a version (Use)

 # don't have to match exact number. `nvm use 16`
nvm use <node_version>
# or use the latest   
nvm use --lts
Enter fullscreen mode Exit fullscreen mode

Get path to installed node

# /Users/pratikthapa/.nvm/versions/node/v20.10.0/bin/node
nvm which node 
Enter fullscreen mode Exit fullscreen mode

Uninstall a Version of NodeJs

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

Help

nvm --help # get help documents
Enter fullscreen mode Exit fullscreen mode

Top comments (0)