Skip to content

1111mp/nvm-desktop

Repository files navigation

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

You can also manage all versions of Node.js directly from the command line. The nvmd does not provide the Node.js download and installation functions. If you need to download and install a new version of Node.js, you should open the nvm-desktop application.

nvmd allows you to quickly manage different versions of Node.js via the command line.

$ 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 (2.2.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 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.