How to Install and Use fnm: The Fast Rust‑Based Node.js Version Manager

fnm is a fast, Rust‑built, cross‑platform Node.js version manager that simplifies installing, switching, and uninstalling Node versions, with step‑by‑step instructions for WSL and Windows installations, usage commands, alias setup, and common operations, all illustrated with code snippets and screenshots.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
How to Install and Use fnm: The Fast Rust‑Based Node.js Version Manager

Overview

fnm is a Node.js version manager written in Rust. It works on macOS, Linux and Windows and manages Node versions by downloading official binaries.

Installation

Unix‑like (WSL, macOS, Linux)

# Initial install
curl -fsSL https://fnm.vercel.app/install | bash

# Upgrade later (skip modifying the current shell)
curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell

# Enable automatic version switching and optional mirror
# Add the following line to your shell profile (e.g., ~/.zshrc or ~/.bashrc)
eval "$(fnm env --use-on-cd --node-dist-mirror=https://repo.huaweicloud.com/nodejs/)"

Windows

Download fnm.exe from the official release page, place it in a directory (e.g., D:\fnm) and add that directory to the system PATH. Then run the following in PowerShell to enable automatic switching:

fnm env --use-on-cd | Out-String | Invoke-Expression

Managing Node versions

Installation commands

# Install the latest LTS release
fnm install --lts

# Install the newest version of a major release (e.g., 18.x)
fnm install 18

# Install an exact version
fnm install 18.21.1

To remove a version or its alias:

fnm uninstall 18.21.1          # remove a specific version
fnm uninstall v18             # remove an alias (also deletes the alias)

Selecting a version for the current shell

# Use the system‑installed Node
fnm use system

# Use a specific installed version
fnm use 18.21.1

# Use the latest installed version of a major release
fnm use 18
After fnm use <version> the chosen version becomes the default for all new shell sessions.

Aliases

# Create an alias for a version
fnm alias 18.21.1 v18

# Switch using the alias
fnm use v18

Common commands

# Show help
fnm --help

# List installed versions
fnm list

# Set a default version that will be used when no other version is selected
fnm default 18.21.1
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

CLIcross-platformRustNode.jsfnmversion manager
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.