DEV Community

Željko Šević
Željko Šević

Posted on • Originally published at sevic.dev on

Node Version Manager (nvm) overview

nvm facilitates switching between different Node versions across projects. This post covers its overview from installation to version management.

Installation

To install nvm, execute the following commands in your terminal. This example uses zsh, but the process is similar for other shells like bash.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Version management

  • Install the specific version. Including the v prefix is optional.
nvm install v21.7.2
Enter fullscreen mode Exit fullscreen mode
  • Install the latest version
nvm install node
Enter fullscreen mode Exit fullscreen mode
  • Install the latest one for the specified major version
nvm install 22
Enter fullscreen mode Exit fullscreen mode
  • Switch to a specific installed version
nvm use 21
Enter fullscreen mode Exit fullscreen mode
  • Add .nvmrc file inside the project directory and run nvm use command to use the specified installed version.
v21.7.2
Enter fullscreen mode Exit fullscreen mode
  • Get the list of locally installed versions
nvm ls
Enter fullscreen mode Exit fullscreen mode
  • Get the list of available versions for installation
nvm ls-remote
Enter fullscreen mode Exit fullscreen mode

Course

Build your SaaS in 2 weeks - Start Now

Top comments (0)