| Command | Alias | Description |
|---|
fnm install [version] | fnm i | Install a Node.js version |
fnm use [version] | | Switch to a Node.js version |
fnm list | fnm ls | List locally installed versions |
fnm list-remote | fnm ls-remote | List all available remote versions |
fnm current | | Print the active Node.js version |
fnm default [version] | | Set or get the default version |
fnm alias <version> <name> | | Create a named alias for a version |
fnm unalias <name> | | Remove a named alias |
fnm uninstall [version] | fnm uni | Uninstall a Node.js version |
fnm exec [args...] | | Run a command inside a specific Node.js context |
fnm env | | Print shell environment setup for fnm |
fnm completions | | Print shell completions to stdout |
# macOS / Linux via curl
curl -fsSL https://fnm.vercel.app/install | bash
# macOS via Homebrew
brew install fnm
# Windows via winget
winget install Schniz.fnm
# Windows via Chocolatey
choco install fnm
# Bash — add to ~/.bashrc
eval "$(fnm env --use-on-cd --version-file-strategy=recursive)"
# Zsh — add to ~/.zshrc
eval "$(fnm env --use-on-cd --version-file-strategy=recursive)"
# Fish — add to ~/.config/fish/config.fish
fnm env --use-on-cd --version-file-strategy=recursive | source
# PowerShell — add to $PROFILE
fnm env --use-on-cd --version-file-strategy=recursive | Out-String | Invoke-Expression
fnm install 20 # Install Node.js v20 (latest minor)
fnm install 20.11.0 # Install exact version
fnm install --lts # Install latest LTS release
fnm install --latest # Install latest available version
fnm install lts/iron # Install by LTS codename
fnm install 20 --use # Install and switch to it immediately
fnm use 20 # Switch to Node.js v20
fnm use 18.12.0 # Switch to exact version
fnm use lts/hydrogen # Switch to LTS codename
fnm use --install-if-missing 22 # Install first if not present
fnm list # List locally installed versions
fnm ls # Alias for list
fnm list-remote # List all available remote versions
fnm ls-remote # Alias for list-remote
fnm ls-remote --lts # Show only LTS versions
fnm ls-remote --filter 20 # Filter by version
fnm ls-remote --latest # Show only the latest matching version
fnm ls-remote --sort=desc # Sort from latest to earliest
fnm alias 20.11.0 myalias # Create alias for a version
fnm unalias myalias # Remove an alias
fnm default 20 # Set v20 as the default version
fnm default # Print current default version
fnm current # Print the active Node.js version
node --version # Confirm via node itself
fnm exec --using=18 node --version # Run node v18 without switching
fnm exec --using=20 npm install # Run npm with a specific Node version
# fnm reads .node-version or .nvmrc automatically when --use-on-cd is set
echo "20" > .node-version # Project requests Node v20
echo "lts/iron" > .nvmrc # Or using LTS codename
cd my-project # fnm switches automatically on cd
# --use-on-cd: auto-switch version when changing directories (recommended)
eval "$(fnm env --use-on-cd)"
# --version-file-strategy=recursive: search parent dirs for .node-version / .nvmrc (recommended)
eval "$(fnm env --version-file-strategy=recursive)"
# --resolve-engines: use engines.node in package.json as version file (experimental)
eval "$(fnm env --resolve-engines)"
# --corepack-enabled: run `corepack enable` on each new Node install (experimental)
eval "$(fnm env --corepack-enabled)"
# Combine recommended flags
eval "$(fnm env --use-on-cd --version-file-strategy=recursive)"
FNM_DIR=/path/to/dir # Root directory for fnm installations
FNM_NODE_DIST_MIRROR=https://npmmirror.com/mirrors/node # Custom Node dist mirror
FNM_LOGLEVEL=quiet # Log level: quiet | error | info
FNM_ARCH=x64 # Override binary architecture
FNM_VERSION_FILE_STRATEGY=recursive # local | recursive
FNM_COREPACK_ENABLED=true # Enable corepack on install
FNM_RESOLVE_ENGINES=true # Use package.json engines.node
fnm completions --shell bash # Generate Bash completions
fnm completions --shell zsh # Generate Zsh completions
fnm completions --shell fish # Generate Fish completions
fnm completions --shell powershell # Generate PowerShell completions
# Install Zsh completions
fnm completions --shell zsh > ~/.zfunc/_fnm
fnm uninstall 18.12.0 # Remove a specific version
fnm uni 16 # Alias for uninstall
# Note: removing an alias target also removes all aliases pointing to it