DEV Community

Cover image for Easily install and manage multiple Node.js versions using nvm-desktop
The1111mp
The1111mp

Posted on

Easily install and manage multiple Node.js versions using nvm-desktop

Introduction

As a front-end development engineer, we usually install Node.js by downloading the binary installation package from the official website. 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 (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 logo 1111mp / nvm-desktop

Node Version Manager Desktop - A desktop application to manage multiple active node.js versions.

Node Version Manager Desktop

nvm-desktop is a desktop application that manages multiple Node versions in a visual interface. It is built with Tauri (supports macOS, Windows and Linux platform). With this application, you can quickly install, manage and use different versions of Node.

Now you can set the Node.js version for your project individually.

The ability to intelligently identify the correct Node.js version is powered by nvmd-command. It’s a single, fast native executable, with no external dependencies, build with Rust.

English | 简体中文

Table of Contents

Screenshot

Screenshot 2024-10-05 at 10 09 27 Screenshot 2024-10-05 at 10 08 31

Maybe somethings you need to know

All the files related to nvm-desktop are located in the "$HOME/.nvmd/" directory:

  • "bin/"(floder) All the shims of the Node.js are stored. The…

Screenshot

Image description

Download and Install

Download

Download link: nvmd-desktop Download Page (GitHub release)

Release v2.6.0

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 or this article (Fix 'File/App is damaged and cannot be opened' on Mac) 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.

Start Using

Take the macOS platform as an example:

Image description

Image description

Image description

Image description

Image description

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

export NVMD_DIR="$HOME/.nvmd"
export PATH="$NVMD_DIR/bin:$PATH"
Enter fullscreen mode Exit fullscreen mode

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

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

Image description

Set different Node.js versions for different projects:

Image description

Find the version you need to download and install:

Image description

Image description

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

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):

$ 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
Enter fullscreen mode Exit fullscreen mode

nvmd --help

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.
Enter fullscreen mode Exit fullscreen mode

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.

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

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

Set the v20.5.0 version for the project:

Image description

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

Image description

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

Windows:
Image description

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):

Image description

Custom download mirror address

The default download mirror address is 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

Change the installation path of Node.js

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

Image description

Multi-Language and Multi-Theme

Multi-language currently supports English and Simplified Chinese:

Image description

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

Image description

Installed Interface

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

Image description

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

At Last

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

Github link:

Download link:

Top comments (0)