Skip to content

fnm Download Management

fnm provides flexible download configuration options to help you quickly obtain Node.js versions.

Basic Download

Install Command

bash
# Install latest LTS
fnm install --lts

# Install specific version
fnm install 20

# Install latest version
fnm install --latest

Download Progress

fnm displays download progress bar by default:

bash
# Auto display (default)
fnm install 20 --progress=auto

# Always display
fnm install 20 --progress=always

# Never display
fnm install 20 --progress=never

Mirror Configuration

Why You Need a Mirror

The official Node.js download source is located overseas, and downloads may be slow in mainland China. Configuring a mirror can significantly improve download speed.

Configuration Methods

Method 1: Environment Variable

bash
export FNM_NODE_DIST_MIRROR=https://npmmirror.com/mirrors/node

Method 2: Command Line Parameter

bash
fnm install 20 --node-dist-mirror=https://npmmirror.com/mirrors/node

Method 3: Shell Configuration

bash
# Add to Shell configuration file
eval "$(fnm env --use-on-cd --node-dist-mirror=https://npmmirror.com/mirrors/node)"

Common Mirror Sources

Mirror SourceURLDescription
Node.js Officialhttps://nodejs.org/distDefault source
npmmirrorhttps://npmmirror.com/mirrors/nodeRecommended
Tsinghua Universityhttps://mirrors.tuna.tsinghua.edu.cn/nodejs-releaseEducation network optimized
Huawei Cloudhttps://mirrors.huaweicloud.com/nodejsEnterprise grade

Platform-Specific Configuration

Linux / macOS

bash
# Add to ~/.bashrc or ~/.zshrc
export FNM_NODE_DIST_MIRROR=https://npmmirror.com/mirrors/node

Windows PowerShell

powershell
# Set user environment variable
[Environment]::SetEnvironmentVariable("FNM_NODE_DIST_MIRROR", "https://npmmirror.com/mirrors/node", "User")

Windows CMD

cmd
setx FNM_NODE_DIST_MIRROR "https://npmmirror.com/mirrors/node"

Download Directory

Default Directory

fnm downloads and installs Node.js to:

~/.fnm/
├── fnm                 # fnm binary
├── node-versions/      # Node.js versions directory
│   ├── v20.10.0/
│   │   └── installation/
│   └── v18.19.0/
│       └── installation/
└── aliases/            # Alias configuration

Custom Directory

Customize via FNM_DIR environment variable:

bash
export FNM_DIR=/custom/path/.fnm

Offline Installation

Pre-download Versions

Pre-download in a networked environment:

bash
fnm install 20
fnm install 18
fnm install 16

Copy to Offline Environment

Copy the ~/.fnm directory to the offline environment:

bash
# Package
tar -czvf fnm-backup.tar.gz ~/.fnm

# Extract in offline environment
tar -xzvf fnm-backup.tar.gz -C ~/

Manual Installation

  1. Download Node.js archive from mirror
  2. Extract to fnm directory:
bash
# Download
wget https://npmmirror.com/mirrors/node/v20.10.0/node-v20.10.0-linux-x64.tar.gz

# Extract to fnm directory
mkdir -p ~/.fnm/node-versions/v20.10.0/installation
tar -xzf node-v20.10.0-linux-x64.tar.gz -C ~/.fnm/node-versions/v20.10.0/installation --strip-components=1

Architecture Selection

View Current Architecture

bash
fnm current
# Output includes architecture information

Install Different Architecture

bash
# Install x64 version
fnm install 20 --arch=x64

# Install ARM64 version
fnm install 20 --arch=arm64

Environment Variable Setting

bash
export FNM_ARCH=x64
fnm install 20

Download Troubleshooting

Download Failed

bash
# Try using mirror
fnm install 20 --node-dist-mirror=https://npmmirror.com/mirrors/node

# Check network connection
curl -I https://nodejs.org/dist/

# View detailed logs
fnm install 20 --log-level=info

Slow Download

  1. Configure domestic mirror
  2. Check network proxy settings
  3. Use offline installation method

Checksum Failed

bash
# Clear cache and re-download
rm -rf ~/.fnm/node-versions/v20.10.0
fnm install 20