Skills2026年4月13日·1 分钟阅读

fnm — Fast and Simple Node.js Version Manager

fnm (Fast Node Manager) is a blazing-fast Node.js version manager built in Rust. It installs and switches Node.js versions instantly, supports .node-version and .nvmrc files, and is 40x faster than nvm with cross-platform support.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
step-1.md
先审查命令
npx -y tokrepo@latest install 81fadebf-3745-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
fnm manages Node.js versions 40x faster than nvm, with automatic version switching per directory.
§01

What it is

fnm (Fast Node Manager) is a Node.js version manager built in Rust. It installs and switches between Node.js versions instantly, supports .node-version and .nvmrc files, and works on macOS, Linux, and Windows. fnm is a drop-in replacement for nvm with dramatically faster performance.

fnm is for any JavaScript or TypeScript developer who works across multiple projects requiring different Node.js versions.

The project is actively maintained with regular releases and a growing user community. Documentation covers common use cases, and the open-source nature means you can inspect the source code, contribute fixes, and adapt the tool to your specific requirements.

§02

How it saves time or tokens

Traditional version managers like nvm add noticeable shell startup latency (200-500ms per new terminal). fnm loads in under 1ms because it is a compiled Rust binary, not a shell script. Automatic version switching via .node-version files means you never run the wrong Node version in a project directory.

§03

How to use

  1. Install fnm via curl, brew, or cargo.
  2. Add the shell integration to your shell profile (bash, zsh, fish, or PowerShell).
  3. Run fnm install <version> and fnm use <version> to manage Node.js versions.
§04

Example

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

# Or via Homebrew
brew install fnm

# Add to .zshrc
eval "$(fnm env --use-on-cd)"

# Install and use Node.js versions
fnm install 22
fnm use 22
node --version  # v22.x.x

# Auto-switch: create .node-version
echo '20' > .node-version
cd .  # fnm switches to Node 20 automatically
§05

Related on TokRepo

§06

Common pitfalls

  • Forgetting to add eval "$(fnm env --use-on-cd)" to your shell profile means automatic version switching will not work.
  • fnm and nvm can conflict if both are installed. Remove nvm initialization from your shell profile before switching to fnm.
  • On Windows, fnm requires the --shell powershell flag for proper integration with PowerShell.

Before adopting this tool, evaluate whether it fits your team's existing workflow. Read the official documentation thoroughly, and start with a small proof-of-concept rather than a full migration. Community forums, GitHub issues, and Stack Overflow are valuable resources when you encounter edge cases not covered in the documentation.

常见问题

How much faster is fnm than nvm?+

fnm is approximately 40x faster than nvm for shell startup. nvm is a bash script that adds 200-500ms to every new terminal session. fnm is a compiled Rust binary that loads in under 1ms.

Does fnm support .nvmrc files?+

Yes. fnm reads both .node-version and .nvmrc files. When you cd into a directory containing either file, fnm automatically switches to the specified Node.js version if you have --use-on-cd enabled.

Can fnm replace nvm completely?+

For most users, yes. fnm supports the same core commands (install, use, list, default) and reads the same version files. Some nvm-specific features like reinstalling global packages on upgrade are handled differently in fnm.

Does fnm work on Windows?+

Yes. fnm has native Windows support via PowerShell and cmd. Install via winget, scoop, or chocolatey. The --shell powershell flag enables automatic version switching in PowerShell sessions.

How does fnm handle multiple Node versions simultaneously?+

fnm uses per-shell version resolution. Each terminal session can use a different Node.js version. The version is determined by the .node-version file in the current directory, the default alias, or an explicit fnm use command.

引用来源 (3)
  • fnm GitHub— fnm is a fast and simple Node.js version manager built in Rust
  • fnm README— fnm supports .node-version and .nvmrc files
  • Rust Language— Rust provides zero-cost abstractions for CLI performance

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产