Node managerNode 管理器
fnm / nvm / brew / vfox — keep exactly one.fnm / nvm / brew / vfox —— 只留一套。
Pick one Node version manager. Mixing fnm / nvm / brew node / vfox makes PATH fight itself. The choice is saved in ~/.config/hekouwang-terminal/node-manager; the shell snippet is ~/.config/hekouwang-terminal/node.sh. ~/.zshrc sources only that snippet, so switching managers does not rewrite your whole rc file.只选一套 Node 版本管理器。混用 fnm / nvm / brew node / vfox 会让 PATH 打架。选择记在 ~/.config/hekouwang-terminal/node-manager;实际加载的是 ~/.config/hekouwang-terminal/node.sh。~/.zshrc 只 source 这一份片段,换管理器不用改整份 rc。
How to tell which one is active怎么判定当前用的是哪套
Check the saved choice first, then what the current shell actually loaded:先看「记录里选了哪套」,再看「当前 shell 实际加载了什么」:
# 1) Saved choice (the file the dashboard reads)1) 记录里的选择(仪表盘读的就是它) $ cat ~/.config/hekouwang-terminal/node-manager # 2) Same value, formatted; no file means not chosen yet2) 同一个值,格式化输出;文件不存在=还没选过 $ ./scripts/node-mgr.sh --status $ ./scripts/doctor.sh --status # dashboard `node` row仪表盘的 node 行 # 3) What this shell really sees3) 当前 shell 真正看到的东西 $ command -v node && node -v $ type fnm nvm vfox 2>/dev/null
A healthy setup loads exactly one manager. If type shows more than one, the conflict check below will catch it.正常状态只加载一套管理器。若 type 同时列出两套以上,下面的冲突检查会报出来。
The four choices四选一
| Choice选项 | Install安装 | What the snippet actually runs片段实际执行什么 |
|---|---|---|
fnm |
brew install fnm |
command -v fnm && eval "$(fnm env --use-on-cd)" — switches versions on cd via .nvmrc / .node-version.command -v fnm && eval "$(fnm env --use-on-cd)" —— 进目录时按 .nvmrc / .node-version 自动切版本。 |
nvm |
brew install nvmor the official ~/.nvm或官方 ~/.nvm |
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}", then source $NVM_DIR/nvm.sh. Falls back to $HOMEBREW_PREFIX/opt/nvm/nvm.sh, /opt/homebrew/opt/nvm/nvm.sh, /usr/local/opt/nvm/nvm.sh.export NVM_DIR="${NVM_DIR:-$HOME/.nvm}",再 source $NVM_DIR/nvm.sh。找不到时依次回退到 $HOMEBREW_PREFIX/opt/nvm/nvm.sh、/opt/homebrew/opt/nvm/nvm.sh、/usr/local/opt/nvm/nvm.sh。 |
brew |
brew install node |
Puts $HOMEBREW_PREFIX/opt/node/bin on PATH (or brew --prefix node). One current Node, not a version manager.把 $HOMEBREW_PREFIX/opt/node/bin 加进 PATH(或 brew --prefix node)。只有一个当前版本,不是版本管理器。 |
vfox |
brew install vfox |
command -v vfox && eval "$(vfox activate zsh)"; then vfox add nodejs and vfox use nodejs@<version>.command -v vfox && eval "$(vfox activate zsh)";再 vfox add nodejs 与 vfox use nodejs@<版本>。 |
Switch and verify切换与验证
$ ./scripts/node-mgr.sh fnm # default / recommended默认 / 推荐 $ ./scripts/node-mgr.sh nvm $ ./scripts/node-mgr.sh brew # single Homebrew nodeHomebrew 单版本 node $ ./scripts/node-mgr.sh vfox # aliases accepted: fast → fnm · node / brew-node → brew · version-fox → vfox接受别名:fast → fnm · node / brew-node → brew · version-fox → vfox # Reload the shell, then verify重载 shell 后再验证 $ exec zsh $ command -v node && node -v $ cat ~/.config/hekouwang-terminal/node-manager
At install time use ./scripts/install.sh --node fnm|nvm|brew|vfox; it is remembered. If ~/.zshrc does not source the snippet, node-mgr.sh prints a hint — re-run install or add the one source line.安装时也能钉:./scripts/install.sh --node fnm|nvm|brew|vfox,会记住。若 ~/.zshrc 没有 source 那份片段,node-mgr.sh 会提示 —— 重跑安装或补那一行 source。
When two managers conflict两套管理器打架时
./scripts/doctor.sh section 6 scans ~/.zshrc, ~/.zshrc.local and the generated node.sh for four patterns: fnm env, NVM_DIR / nvm.sh, vfox activate, and opt/node / brew --prefix node. More than one match is reported as a conflict../scripts/doctor.sh 第 6 节会扫 ~/.zshrc、~/.zshrc.local 和生成的 node.sh,找四类特征:fnm env、NVM_DIR / nvm.sh、vfox activate、opt/node / brew --prefix node。命中两类以上即报冲突。
./scripts/node-mgr.sh <choice>, then remove the other loader from where it lives: your own lines in ~/.zshrc.local, or the template block in ~/.zshrc. Open a new tab and re-run ./scripts/doctor.sh; section 6 should say no conflict.先用 ./scripts/node-mgr.sh <选项> 定一套,再从它所在的位置删掉另一套:你自己写在 ~/.zshrc.local 的行,或 ~/.zshrc 里的模板块。新开 tab 后重跑 ./scripts/doctor.sh,第 6 节应显示无冲突。