fnm
Manage multiple Node.js versions
TLDR
Install a specific version of Node.js
List all available Node.js versions and highlight the default one
Use a specific version of Node.js in the current shell
Set the default Node.js version
Uninstall a given Node.js version
SYNOPSIS
fnm [options]
fnm install [version]
fnm use [version]
fnm default [version]
fnm exec [version] --
fnm env
PARAMETERS
install [version]
Installs a specific Node.js version. Can be 'latest', 'lts', or a precise version number (e.g., '16.14.0').
use [version]
Switches the current shell to use a specified Node.js version. Prompts for installation if the version isn't already present.
default [version]
Sets a specific Node.js version as the system-wide default for future shell sessions.
list | ls
Lists all Node.js versions currently installed by fnm.
uninstall [version]
Removes a specified Node.js version from the system.
current
Displays the Node.js version currently active in the shell.
exec [version] --
Executes a command using a specified Node.js version without altering the shell's active version.
env
Outputs shell commands (e.g., export PATH) required to set up fnm. Must be sourced in your shell's configuration file.
--help | -h
Displays help information for fnm or a specific subcommand.
--version | -v
Shows the installed fnm version.
--force | -f
Forces an operation, such as re-installing an existing Node.js version.
DESCRIPTION
fnm (Fast Node Manager) is a Node.js version manager developed in Rust, designed to be significantly faster and more lightweight than traditional alternatives like nvm.
It enables users to easily install, switch between, and manage multiple Node.js versions on their system. fnm automatically detects Node.js versions via .node-version or .nvmrc files, streamlining development workflows. Its performance benefits are especially noticeable in environments requiring frequent Node.js version changes, such as CI/CD pipelines or large monorepos. fnm integrates seamlessly with common shells by providing environment setup commands, ensuring a smooth user experience across various platforms including Linux, macOS, and Windows.
CAVEATS
For fnm to function correctly across shell sessions, the output of fnm env must be sourced in your shell's configuration file (e.g., .bashrc, .zshrc). This ensures the correct PATH and other environment variables are set. While highly performant, it may not support every niche feature found in more mature Node.js managers like nvm.
AUTOMATIC VERSION SWITCHING
fnm supports automatic Node.js version switching based on .node-version or .nvmrc files located in the current directory or any parent directory. This feature helps maintain consistent Node.js environments across different projects without manual intervention.
CROSS-PLATFORM COMPATIBILITY
Built with Rust, fnm offers excellent cross-platform compatibility, providing a consistent Node.js management experience on Linux, macOS, and Windows operating systems.
HISTORY
fnm was created by Gal Schlezinger (Schniz) and first publicly released in 2019. Its development was driven by a need for a faster and more efficient Node.js version manager, particularly for scenarios where nvm's performance could be a bottleneck. By being written in Rust, fnm achieves native performance and a smaller footprint, quickly gaining popularity in the Node.js ecosystem.