Easily install and manage multiple Node.js versions using nvm-desktop
Tags: node, javascript, opensource, tutorial
Published: 2023-11-25 06:05:26

## Introduction

As a front-end development engineer, we usually install Node.js by downloading the binary installation package from [the official website](https://nodejs.org/). However, in actual development, it is inevitable that due to some compatibility issues, we need to install and switch to different versions of Node.js. If we still use this method, then It is undoubtedly very inconvenient to have to uninstall the existing version before installing the new version.

Today we will introduce a tool to install and manage multiple Node.js versions through visual interface operation: [**nvm-desktop**](https://github.com/1111mp/nvm-desktop) (full name: **`Node Version Manager Desktop`**). Supports Windows and macOS, the code is completely open source and can be used with confidence.

Supports setting up and switching different versions of Node separately for different projects.

{% github 1111mp/nvm-desktop %}

## Screenshot

{% vimeo 888174068 %}

{% vimeo 888174106 %}

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nknyijn8968yq52o11f9.png)

## Download and Install

### Download

Download link: [nvmd-desktop Download Page (GitHub release)](https://github.com/1111mp/nvm-desktop/releases)

![Release v2.6.0](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ignbui7cxusnghagch16.png)

Depending on the platform, download the latest version.

### Install

After downloading the binary installer for the corresponding platform, double-click to install it.

Because the program is currently not signed with a certificate through an Apple developer account, a security prompt will appear when running on macOS:

> "File/App is damaged and cannot be opened. You should move it to Trash."

> "File/App is damaged and cannot be opened. You should move it to Trash." is a Mac error that can occur to various macOS versions, such as macOS Ventura/Monterey/Big Sur/Catalina, especially on M1 Macs. It usually happens on apps or files downloaded from the web, but it can also arise when opening apps downloaded from App Store.

You can check the **nvm-desktop** [documentation](https://github.com/1111mp/nvm-desktop#macos-issues) or this article ([Fix 'File/App is damaged and cannot be opened' on Mac](https://iboysoft.com/news/app-is-damaged-and-cannot-be-opened.html#:~:text=If%20you%27re%20certain%20the%20file%20or%20app%20is,and%20selecting%20Open%20twice.%204%20Restart%20your%20Mac.)) to allow the program to run.

On the Windows platform, you need to trust this software in the firewall.

Because the project code is completely open source, please feel free to run it. Or you can clone the code to local compile and install according to the tutorial in the [documentation](https://github.com/1111mp/nvm-desktop#build-and-package).

## Start Using

Take the macOS platform as an example:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eywsevjmfb5t65o8xoas.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/urbixnt71w4y6yp6s4sv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbcz9rqurdls2j5udoqu.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lkl5sky8xfwtgocrt1o1.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iotqhe5gm7enqt6mw8wx.png)

According to the wizard, the following commands need to be added to the system's `~/.bashrc`, `~/.profile` or `~/.zshrc` files:

```shell
export NVMD_DIR="$HOME/.nvmd"
export PATH="$NVMD_DIR/bin:$PATH"
```

Under Windows, no additional operations are required. After installation and operation, directly search for the specified Node.js version and click to download and install it.

**Enter the main page**:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxfuhacy0kb99qn5sjtb.png)

Node.js supports the `arm64` architecture of macOS starting from `v16.0.0`:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u5o78apnym8j4t1my8z0.png)

Set different Node.js versions for different projects:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnlyswp1s0fksp4gdh9x.png)

Find the version you need to download and install:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7fuk232nyw8mesntql5.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o9q6w6rnovy7gbrebk7j.png)

You can check the download progress in real time or cancel the download.

After installation, click the **Apply** button to set it to the current Node.js version:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z1bxykhac3p520z95cgs.png)

Check if it works by typing `node --version` & `npm --version` in the terminal.

## Other Features

### Command Tool

The `nvmd` allows you to quickly manage different versions of Node.js through the command line (`nvmd` does not provide the download and installation function of Node.js. If you need to download and install a new version of Node.js, please open the `nvm-desktop` application):

```shell
$ nvmd use 18.17.1
Now using node v18.17.1
$ node -v
v18.17.1
$ nvmd use v20.5.1 --project
Now using node v20.5.1
$ node -v
v20.5.1
$ nvmd ls
v20.6.1
v20.5.1 (currently)
v18.17.1
$ nvmd current
v20.5.1
```

`nvmd --help`：

```shell
nvmd (2.6.0)
command tools for nvm-desktop

Usage: nvmd [COMMAND]

Commands:
  current  Get the currently used version
  list     List the all installed versions of Node.js
  ls       List the all installed versions of Node.js
  use      Use the installed version of Node.js (default is global)
  which    Get the path to the executable to where Node.js was installed
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Please download new version of Node.js in nvm-desktop.
```

After you switch the Node.js version through the **nvmd** use command line, please click the refresh button to let **nvm-desktop** synchronize the latest data.

See this documentation for more details: [command-tools-intro](https://github.com/1111mp/nvmd-command#command-tools-intro).

### Set Node versions individually for projects

It does not rely on the functions and shell of the operating system, and perfectly supports switching different Node.js versions for the project, and there is no need to restart the terminal after switching.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t23vzcmbyb3rpyfrflcu.png)

Click the Add Project button, select the project directory, and then select the required version of Node.js (already installed) for the project.

After selecting a version, a `.nvmdrc` file will be added to the root directory of your project, containing the selected version number. `nvm-desktop` sets the version of Node.js for the terminal through this file. Open your terminal and go to the project directory, and run `node --version` to see if it works.

The globally set Node.js version is `v20.6.1`:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vbdeim7bvfxoomt7zmj.png)

Set the `v20.5.0` version for the project:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ylaqvi2sroo5x5y9eb17.png)

Check in the root directory of the project in the terminal:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tu2e8z24p6cm3390h9uf.png)

### Quickly manage Node.js versions through the system tray menu

Avoid frequently opening interface windows and quickly switch Node.js versions through menu bar options.

`macOS`:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rn8zl12czn70cohezuoh.png)

`Windows`:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4oisodb7l8d367f24pm.png)

### Synchronize the latest released Node.js version

Because all Node.js version information data will be cached by default, if you want to view the latest released Node.js version, click the `Remote Refresh` button to synchronize the latest data (You can view it through the official link:[https://nodejs.org/dist/index.json](https://nodejs.org/dist/index.json)):

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7tbzao62xi5prgcki25m.png)

### Custom download mirror address

The default download mirror address is [https://nodejs.org/dist](https://nodejs.org/dist). If the download speed is slow in your area, then you can change the download address that suits you to download quickly.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/loec8rn7ke3kinsue1b8.png)

### Change the installation path of Node.js

The default installation path is: `$HOME/.nvmd/versions`:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wadb9xfzuoucejvwxr6m.png)

### Multi-Language and Multi-Theme

Multi-language currently supports English and Simplified Chinese:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kmtf6rgvfs5id0jy4jmm.png)

The theme currently supports three modes: `follow system`, `light` and `dark`:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k9mvnfpndow17s40slok.png)

### Installed Interface

Quickly find the installed and currently used version of Node.js on the installed interface for easy management.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n9160f90rzld4q5ceawh.png)

### View the Node.js release log

By clicking the version number of Node.js on the main interface, you can jump to the officially released `Changelog interface` of the corresponding version (keep track of the trends of the new version at any time):

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xkqxp0ynszeyup87it0n.png)

## At Last

Hope you enjoy this project I shared. Thank you. 😃

`Github` link：
- [nvm-desktop](https://github.com/1111mp/nvm-desktop)

Download link：
- [nvmd-desktop Download Page (GitHub release)](https://github.com/1111mp/nvm-desktop/releases)