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 --latestDownload 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=neverMirror 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/nodeMethod 2: Command Line Parameter
bash
fnm install 20 --node-dist-mirror=https://npmmirror.com/mirrors/nodeMethod 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 Source | URL | Description |
|---|---|---|
| Node.js Official | https://nodejs.org/dist | Default source |
| npmmirror | https://npmmirror.com/mirrors/node | Recommended |
| Tsinghua University | https://mirrors.tuna.tsinghua.edu.cn/nodejs-release | Education network optimized |
| Huawei Cloud | https://mirrors.huaweicloud.com/nodejs | Enterprise grade |
Platform-Specific Configuration
Linux / macOS
bash
# Add to ~/.bashrc or ~/.zshrc
export FNM_NODE_DIST_MIRROR=https://npmmirror.com/mirrors/nodeWindows 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 configurationCustom Directory
Customize via FNM_DIR environment variable:
bash
export FNM_DIR=/custom/path/.fnmOffline Installation
Pre-download Versions
Pre-download in a networked environment:
bash
fnm install 20
fnm install 18
fnm install 16Copy 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
- Download Node.js archive from mirror
- 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=1Architecture Selection
View Current Architecture
bash
fnm current
# Output includes architecture informationInstall Different Architecture
bash
# Install x64 version
fnm install 20 --arch=x64
# Install ARM64 version
fnm install 20 --arch=arm64Environment Variable Setting
bash
export FNM_ARCH=x64
fnm install 20Download 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=infoSlow Download
- Configure domestic mirror
- Check network proxy settings
- Use offline installation method
Checksum Failed
bash
# Clear cache and re-download
rm -rf ~/.fnm/node-versions/v20.10.0
fnm install 20Related Links
- Install Node.js - Installation guide
- Version Management - Version management
- Command Reference - All command details