Node Version Manager Desktop

A desktop application to manage multiple active Node.js versions.
GitHub
1.04k
Created a year ago, last commit 3 days ago
3 contributors
260 commits
Stars added on GitHub, month by month
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
Stars added on GitHub, per day, on average
Yesterday
+1
Last week
+1.3
/day
Last month
+2.9
/day
README

Node Version Manager Desktop

nvm-desktop is a desktop application that helps you manage multiple Node.js versions through a visual interface. The application is built using Tauri and supports macOS, Windows, and Linux systems. It allows you to easily and quickly install, manage, and switch between different Node.js versions without relying on any OS-specific features or shells.

The program also supports independently setting and switching Node.js versions between different projects. Each version's environment is isolated, meaning global dependencies installed via npm under one version will not be available when switched to another version. To share these global dependencies, you can use the npm config set prefix "/path/to/folder" command to install global packages in a specified directory. When switching Node.js versions, all versions will have access to the packages in that path.

The smart detection of the appropriate Node engine version is powered by nvmd-command, which is a native executable written in Rust with no external dependencies.

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 path "$HOME/.nvmd/bin needs to be added to the environment variable of the system.
macOS Windows
nvmd nvmd.exe
node node.exe
npm npm.exe npm.cmd
npx npx.exe npx.cmd
corepack corepack.exe corepack.cmd
  • "versions/"(floder) It stores all downloaded Node.js version files, and the floder is usually named with the Node.js version number. For example: "$HOME/.nvmd/versions/21.2.0/".
  • "default"(file) The file contains the version number of the node that is set globally, for example: 21.2.0.
  • "migration"(file) Every time nvm-desktop is upgraded, it will control the execution of script code based on this file.
  • "setting.json"(file) It stores information about the nvm-desktop settings center, such as Theme, Language, Mirror Url, etc.
    {
    	"locale": "en",
    	"theme": "system",
    	"closer": "minimize",
    	"directory": "/Users/********/.nvmd/versions",
    	"mirror": "https://nodejs.org/dist"
    }
  • "projects.json"(file) Saves all added projects.
    [
    	{
    		"name": "nvm-desktop",
    		"path": "/Users/********/Documents/Electron/nvm-desktop",
    		"version": "20.6.1",
    		"active": true,
    		"createAt": "2023-11-25T04:07:43.012Z",
    		"updateAt": "2023-11-25T04:07:44.931Z"
    	},
    	{
    		"name": "electron_client",
    		"path": "/Users/********/Documents/projects/electron_client",
    		"version": "20.6.1",
    		"active": true,
    		"createAt": "2023-11-25T04:07:35.172Z",
    		"updateAt": "2023-11-25T04:07:37.234Z"
    	}
    ]
  • "packages.json"(file) Information about the installation of the npm global package is saved. For more information, please check how-does-it-work.
  • "versions.json"(file) Cache details of all Node.js versions requested from "https://nodejs.org/dist"(default).
    [
    	{
    		"version": "v21.2.0",
    		"date": "2023-11-14",
    		"files": [
    			"aix-ppc64",
    			"headers",
    			"linux-arm64",
    			"linux-armv7l",
    			"linux-ppc64le",
    			"linux-s390x",
    			"linux-x64",
    			"osx-arm64-tar",
    			"osx-x64-pkg",
    			"osx-x64-tar",
    			"src",
    			"win-arm64-7z",
    			"win-arm64-zip",
    			"win-x64-7z",
    			"win-x64-exe",
    			"win-x64-msi",
    			"win-x64-zip",
    			"win-x86-7z",
    			"win-x86-exe",
    			"win-x86-msi",
    			"win-x86-zip"
    		],
    		"npm": "10.2.3",
    		"v8": "11.8.172.17",
    		"uv": "1.46.0",
    		"zlib": "1.2.13.1-motley",
    		"openssl": "3.0.12+quic",
    		"modules": "120",
    		"lts": false,
    		"security": false
    	}
    ]

Command tools intro

nvmd allows you to manage Node.js versions via the command line. Note: nvmd does not provide download and installation features. To download and install, please use the nvm-desktop client.

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

nvmd --help:

$ nvmd --help
nvmd (4.0.5)
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 version through the nvmd use command line, please click the refresh button to let nvm-desktop synchronize the latest data.

For more details, please check document: command-tools-intro .

Install

Download

You can download the source code and build it yourself, or download the built version from following links:

The automatic check for updates feature of the application has supported all platforms since version v4.0.0.

Uninstall

macOS Uninstall

  • Uninstall nvm-desktop application

  • rm -rf ~/.nvmd

  • Remove the two lines about nvmd from the shell configuration file:

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

    The default file might be:

    • .zshrc
    • .bashrc
    • .bash_profile
    • .profile

Windows Uninstall

  • Uninstall nvm-desktop application
  • Remove %HOMEPATH%\.nvmd folder
  • Remove environment variables from your system: %HOMEPATH%\.nvmd\bin (will be automatically removed when uninstalling from v4.0.0)

Develop and Build

nvm-desktop relies on nvmd-command to provide intelligent identification of the correct Node engine service, so you need to build an executable file locally. How to build the executable for nvm-desktop please check this document: build-nvmd-command.

  • First, Build an executable for nvm-desktop.
  • Copy the executable to this directory of nvm-desktop:
    • macOS "./assets/sources/nvmd"
    • Windows "./assets/sources/{arch}.exe", example: "./assets/sources/x64.exe" & "./assets/sources/arm64.exe"
  • On Windows platform, you also need to add an additional script file named temp.cmd in the ./assets/sources/temp.cmd directory. The content of the temp.cmd file is:
@echo off
"%~dpn0.exe" %*

Then you can start running and building nvm-desktop locally.

Since version v4.0.0, we have migrated to tauri, so the above operation is no longer necessary. You can directly run the pnpm check command.

Development

  • First, you should have a Rust runtime installed locally. Please read the official guide: rust get started
  • Then, make sure your computer has Node.js installed
  • Change to the "./" folder, run pnpm install to install dependented libraries

There are two ways to start the development server:

  • run pnpm dev
  • F5 one-button start (debug mode)

Build and Package

  • Go to the ./ folder
  • Run pnpm build, if everything goes well, the packaged files will be in the ./src-tauri/target/release/bundle folder.

Managing your project

Now you can choose different Node versions individually for your projects and no need for any other dependencies and extra work.

This feature is enabled by nvmd-command support.

For more details, please check the nvmd-command project.

image

A file will be added to the root of the project: .nvmdrc, the content is the version number of Node you choose. nvm-desktop detects this file to identify the Node version for your project.

Features

  • Supports setting the Node engine version separately for the project.
  • Command tools for manage the version of Node.
  • Support English & Simplified Chinese
  • Support for custom download mirrors (default is https://nodejs.org/dist)
  • Support automatic update.