Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ node -v
`vfox search nodejs` lists every release, with the npm that comes with it and a
mark on the ones of an LTS line. In an interactive terminal it lets you pick one.

Behavior that only exists on `main` and not in the latest release is marked
"Unreleased" in the pages below. [docs/changes.md](docs/changes.md) lists it, and
[docs/source-build.md](docs/source-build.md) gets you `main`.

### Example: Ubuntu 26.04

```bash
Expand Down
2 changes: 0 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ node -v

`vfox search nodejs` 会列出每个版本及其自带的 npm,属于 LTS 版本线的版本带有标记。在交互式终端里可以从中选一个。

只存在于 `main`、还没进入最新发布版的行为,在下面各页里标有“未发布”。[docs/zh-CN/changes.md](docs/zh-CN/changes.md) 里列出了这些行为,想直接用上 `main`,见 [docs/zh-CN/source-build.md](docs/zh-CN/source-build.md)。

### 示例:Ubuntu 26.04

```bash
Expand Down
14 changes: 7 additions & 7 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@

What changed in each release, as a user notices it. GitHub's
[release pages](https://github.com/version-fox/vfox-nodejs/releases) list the
pull requests. The newest release at the time of writing is 0.5.4, and `main` is
ahead of it by everything under "Unreleased".
[source-build.md](source-build.md) gets you those changes now.
pull requests.

## Unreleased
## 0.5.5 (2026-11-10)

- On vfox 1.1.0 and later a `node` that shadows vfox's is reported by vfox
itself with the plugin's hint, instead of the plugin's `Note:`. Release
0.5.4 prints `Note: <shadowing node> comes before vfox in PATH, ...` from
`PreUse` on every vfox, so with the new vfox the same shadowing prints
both the core warning and the plugin note. The plugin now declares
`PLUGIN.shadowHints` for pnpm, mise, asdf, nvm, Homebrew and winget (each
with its handoff command and a link to `docs/pnpm.md` or the new
with its handoff command and a link to `docs/pnpm.md` or
`docs/managers.md`) and keeps its own `Note:` for vfox before 1.1.0
only, which ignores the new metadata field. See [pnpm.md](pnpm.md),
[managers.md](managers.md) and
[troubleshooting.md](troubleshooting.md).
[troubleshooting.md](troubleshooting.md)
([#48](https://github.com/version-fox/vfox-nodejs/pull/48)).
- `vfox link --detect nodejs` links the Node.js already on the machine
instead of downloading another copy: the nvm, mise, asdf and Homebrew
Cellar directories with a working `node` in them, and the winget
directory on Windows, each under the plain release number the binary
reports. Shims, pnpm's global runtime and copies without a versioned
home are skipped. See [managers.md](managers.md).
home are skipped. See [managers.md](managers.md)
([#48](https://github.com/version-fox/vfox-nodejs/pull/48)).

## 0.5.4 (2026-11-04)

Expand Down
4 changes: 1 addition & 3 deletions docs/managers.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ The symptom is always the same: `vfox use nodejs@<version>` prints
the other manager's version, because its `node` comes before vfox's in
`PATH` (`type -a node` lists it first). On vfox 1.1.0 and later vfox
warns itself and appends the plugin's hint for the manager it
recognizes; on older vfox the plugin prints its own `Note:`. Unreleased:
release 0.5.4 prints the `Note:`; on vfox 1.1.0 and later the warning
comes from vfox itself with the plugin's hint.
recognizes; on older vfox the plugin prints its own `Note:`.

Pick at most one manager for `node` in a shell. The fastest way out is
`vfox link --detect nodejs` (needs vfox 1.1.0 or later, which has
Expand Down
2 changes: 1 addition & 1 deletion docs/mirror.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ with the `User-Agent` of Go's HTTP client, `Go-http-client/1.1`, and Huawei
Cloud (HTTP 418), TUNA and BFSU (403) and USTC (204 with no content) answer that
with an error page, or with nothing, in place of the package, which vfox saves.
The plugin asks for `index.json` and `SHASUMS256.txt` with the `User-Agent`
that vfox builds for it, `vfox/1.0.13 vfox-nodejs/0.5.4`, which all of them
that vfox builds for it, `vfox/1.0.13 vfox-nodejs/0.5.5`, which all of them
serve, and it has the download send the same one.

Addresses that only redirect are not listed: on 2026-11-03
Expand Down
6 changes: 3 additions & 3 deletions docs/pnpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Observed with pnpm 12.14.0 and vfox 1.0.12 in bash on Ubuntu.
project lookup; `node` still runs pnpm's global Node.js, not vfox's.

`vfox use nodejs@<version>` warns when a `node` sits ahead of vfox
this way, whichever tool put it there. Unreleased: release 0.5.4 prints
the `Note:` below from the plugin; on vfox 1.1.0 and later the warning
comes from vfox itself with the plugin's hint.
this way, whichever tool put it there. On vfox 1.1.0 and later the warning
comes from vfox itself with the plugin's hint; on older vfox the plugin
prints the `Note:` below.

On vfox 1.1.0 and later:

Expand Down
9 changes: 6 additions & 3 deletions docs/scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ships with Windows 10 and 11, as well as in PowerShell 7, bash, zsh and fish.

Each case below says what you want, what to type and what you see. The outputs
are from 2026-11-03 on Linux x64, with vfox 1.0.13 and the code that became
release 0.5.4, and the home directory is shown as `/home/me`. The PowerShell
release 0.5.5, and the home directory is shown as `/home/me`. The PowerShell
lines were run in PowerShell 7.6.9 on Linux, except those that exist only on
Windows: `Set-ExecutionPolicy` and the user-level
`[Environment]::SetEnvironmentVariable`. Windows PowerShell 5.1 itself is not
Expand Down Expand Up @@ -129,8 +129,11 @@ What is different on Windows:
policy of step 1, or the hook line is in the profile of the other PowerShell.
- Only the first `node` in `PATH` runs. One from the installer of nodejs.org,
from winget or Scoop, or from another version manager can sit in front of
vfox's. `vfox use` then prints a note that names it and says that it comes
before vfox in `PATH`, see [pnpm.md](pnpm.md). Uninstall the other one.
vfox's. `vfox use` then warns about it: on vfox 1.1.0 and later vfox warns
itself with the plugin's hint, on older vfox the plugin prints a note that
names it and says that it comes before vfox in `PATH`, see [pnpm.md](pnpm.md)
and [managers.md](managers.md). Uninstall the other one, or link it with
`vfox link --detect nodejs`.
- A `.nvmrc` that Windows PowerShell 5.1 writes with `>` is UTF-16, which the
plugin reads, see [below](#writing-the-file-from-windows-powershell-51).

Expand Down
2 changes: 1 addition & 1 deletion docs/source-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and `lib/` at its top level; that is the plugin package contract (see the
[shared workflow documentation](https://github.com/version-fox/plugin-manifest-action)).

A released plugin zip URL also works as `--source`, e.g.
`vfox add --source https://github.com/version-fox/vfox-nodejs/releases/download/v0.5.4/vfox-nodejs-0.5.4.zip`.
`vfox add --source https://github.com/version-fox/vfox-nodejs/releases/download/v0.5.5/vfox-nodejs-0.5.5.zip`.

Prerequisites on all systems: [vfox](https://github.com/version-fox/vfox)
itself plus `git`.
Expand Down
6 changes: 3 additions & 3 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ These are not errors.
| `Note: Node.js versions below 16 do not support Apple Silicon (arm64), using x64 architecture with Rosetta 2` | macOS arm64 and a release before 16.0.0, see [platforms.md](platforms.md#macos) |
| `Note: musl libc detected, installed node-v22.23.3-linux-x64-musl.tar.gz. See ...` | the plugin took the musl package, see [musl.md](musl.md) |
| `Note: node-v18.20.8-linux-x64-musl.tar.gz is not listed in https://nodejs.org/dist/v18.20.8/, using unofficial musl build` | nodejs.org has no such musl package and the plugin takes it from unofficial-builds.nodejs.org |
| ``Note: /home/me/.local/share/pnpm/bin/node comes before vfox in PATH, so `node` will not run nodejs@24.21.0. See ...`` | another `node` shadows vfox's on vfox before 1.1.0, see [pnpm.md](pnpm.md) for pnpm and [managers.md](managers.md) for mise, asdf, nvm, Homebrew and winget. Unreleased: release 0.5.4 prints this; on vfox 1.1.0 and later vfox warns itself (`node runs ... instead of nodejs@...`) and appends the plugin's hint |
| ``Note: /home/me/.local/share/pnpm/bin/node comes before vfox in PATH, so `node` will not run nodejs@24.21.0. See ...`` | another `node` shadows vfox's on vfox before 1.1.0, see [pnpm.md](pnpm.md) for pnpm and [managers.md](managers.md) for mise, asdf, nvm, Homebrew and winget |

### Warnings from vfox itself

Unreleased: vfox 1.1.0 and later reports a shadowing `node` with the
plugin's hint; release 0.5.4 prints the `Note:` above from the plugin.
On vfox 1.1.0 and later vfox reports a shadowing `node` with the
plugin's hint; on older vfox the plugin prints the `Note:` above.

| Warning | Meaning |
| --- | --- |
Expand Down
8 changes: 4 additions & 4 deletions docs/zh-CN/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

[中文](changes.md) | [English](../changes.md)

按发布版本列出用户能感受到的变化。GitHub 的 [Release 页面](https://github.com/version-fox/vfox-nodejs/releases)列出了对应的 PR。写这篇文档时最新的发布版是 0.5.4,`main` 比它多出“未发布”下面的所有内容。想现在就用上这些变化,见 [source-build.md](source-build.md)。
按发布版本列出用户能感受到的变化。GitHub 的 [Release 页面](https://github.com/version-fox/vfox-nodejs/releases)列出了对应的 PR。

## 未发布
## 0.5.5(2026-11-10)

- 在 vfox 1.1.0 及以后的版本里,遮蔽 vfox 的 `node` 由 vfox 自己报告,并附带插件的提示,不再由插件打印 `Note:`。0.5.4 会在所有 vfox 上从 `PreUse` 打印 `Note: <shadowing node> comes before vfox in PATH, ...`,所以在新 vfox 上,同一个遮蔽会同时打印核心警告和插件的提示。插件现在为 pnpm、mise、asdf、nvm、Homebrew 和 winget 声明 `PLUGIN.shadowHints`(各自的交接命令,以及指向 `docs/pnpm.md` 或新建 `docs/managers.md` 的链接),只在 1.1.0 之前的 vfox 上保留自己的 `Note:`,老 vfox 会忽略这个新的元数据字段。见 [pnpm.md](pnpm.md)、[managers.md](managers.md)和 [troubleshooting.md](troubleshooting.md)。
- `vfox link --detect nodejs` 会把本机已有的 Node.js 链进来,不用再下载一份:装着可用 `node` 的 nvm、mise、asdf 和 Homebrew Cellar 目录,Windows 上还有 winget 目录,每个都用二进制自己报出的纯版本号命名。shim、pnpm 的全局运行时和没有版本化家目录的复制会被跳过。见 [managers.md](managers.md)。
- 在 vfox 1.1.0 及以后的版本里,遮蔽 vfox 的 `node` 由 vfox 自己报告,并附带插件的提示,不再由插件打印 `Note:`。0.5.4 会在所有 vfox 上从 `PreUse` 打印 `Note: <shadowing node> comes before vfox in PATH, ...`,所以在新 vfox 上,同一个遮蔽会同时打印核心警告和插件的提示。插件现在为 pnpm、mise、asdf、nvm、Homebrew 和 winget 声明 `PLUGIN.shadowHints`(各自的交接命令,以及指向 `docs/pnpm.md` 或 `docs/managers.md` 的链接),只在 1.1.0 之前的 vfox 上保留自己的 `Note:`,老 vfox 会忽略这个新的元数据字段。见 [pnpm.md](pnpm.md)、[managers.md](managers.md)和 [troubleshooting.md](troubleshooting.md)([#48](https://github.com/version-fox/vfox-nodejs/pull/48))。
- `vfox link --detect nodejs` 会把本机已有的 Node.js 链进来,不用再下载一份:装着可用 `node` 的 nvm、mise、asdf 和 Homebrew Cellar 目录,Windows 上还有 winget 目录,每个都用二进制自己报出的纯版本号命名。shim、pnpm 的全局运行时和没有版本化家目录的复制会被跳过。见 [managers.md](managers.md)([#48](https://github.com/version-fox/vfox-nodejs/pull/48))。

## 0.5.4(2026-11-04)

Expand Down
3 changes: 1 addition & 2 deletions docs/zh-CN/managers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ vfox 旁边常见的其他管理器:mise、asdf、nvm、Homebrew,以及 wing
的版本,因为它的 `node` 排在 `PATH` 里 vfox 的前面(`type -a node`
把它列在最前)。在 vfox 1.1.0 及以后的版本里,vfox 自己给出警告,并
附带插件能认出来的那个管理器的提示;在更早的 vfox 里,插件打印自己的
`Note:`。未发布:0.5.4 会由插件打印 `Note:`;在 vfox 1.1.0 及以后的
版本里,这条警告由 vfox 自己打印,并附带插件的提示。
`Note:`。

一个 Shell 里最多让一个管理器管 `node`。最快的是
`vfox link --detect nodejs`(要带 `vfox link` 的 vfox 1.1.0 及以后):
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/mirror.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $env:VFOX_NODEJS_MIRROR = "https://npmmirror.com/mirrors/node"
| 北京外国语大学 | `https://mirrors.bfsu.edu.cn/nodejs-release`(会重定向到 TUNA) |
| 天翼云 | `https://mirrors.ctyun.cn/nodejs-release` |

2026-11-03,又用 vfox 1.0.13 通过它们各安装了一次 24.21.0(`VFOX_NODEJS_MIRROR=<mirror> vfox install nodejs@24.21.0`),每一个都安装成功并且能运行。0.5.4 之前,通过华为云、TUNA、USTC 和北外安装会以 `checksum error` 结束:下载由 vfox 自己完成,它请求时使用的是 Go HTTP 客户端的 `User-Agent`,即 `Go-http-client/1.1`,华为云(HTTP 418)、TUNA 和北外(403)以及 USTC(204,没有内容)对它返回的是错误页面或者空内容,而不是安装包,vfox 把这个回应存成了文件。插件请求 `index.json` 和 `SHASUMS256.txt` 时用的是 vfox 为它生成的 `User-Agent`,即 `vfox/1.0.13 vfox-nodejs/0.5.4`,这些镜像都正常响应,下载时也改用同一个。
2026-11-03,又用 vfox 1.0.13 通过它们各安装了一次 24.21.0(`VFOX_NODEJS_MIRROR=<mirror> vfox install nodejs@24.21.0`),每一个都安装成功并且能运行。0.5.4 之前,通过华为云、TUNA、USTC 和北外安装会以 `checksum error` 结束:下载由 vfox 自己完成,它请求时使用的是 Go HTTP 客户端的 `User-Agent`,即 `Go-http-client/1.1`,华为云(HTTP 418)、TUNA 和北外(403)以及 USTC(204,没有内容)对它返回的是错误页面或者空内容,而不是安装包,vfox 把这个回应存成了文件。插件请求 `index.json` 和 `SHASUMS256.txt` 时用的是 vfox 为它生成的 `User-Agent`,即 `vfox/1.0.13 vfox-nodejs/0.5.5`,这些镜像都正常响应,下载时也改用同一个。

只做重定向的地址没有列出:2026-11-03,`mirror.sjtu.edu.cn/nodejs-release` 把请求转到了 nodejs.org,`mirrors.cernet.edu.cn/nodejs-release` 则转到了中科大的一台服务器。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/pnpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pnpm 作为包管理器使用(比如通过 `npm install -g pnpm` 安装)时
2. 每次出现提示符时,`vfox env` 都会把 `PATH` 里排在它自己的第一个路径之前的条目,保留在所有 SDK 路径的前面,这样已经激活的 Python 虚拟环境才能保持优先。`$PNPM_HOME/bin` 正是这样一个条目。
3. 那个 `node` 是 pnpm 的 shim:它运行 pnpm 的全局 Node.js,或者当前项目通过 `devEngines.runtime`、`engines.runtime`、`.node-version` 或 `.nvmrc` 固定的版本(见[项目感知的全局 bin](https://pnpm.io/global-packages#project-aware-global-bins))。pnpm 的 `globalShims` 设置和 `PNPM_SHIM_BYPASS=1` 只能关掉按项目查找;`node` 运行的仍然是 pnpm 的全局 Node.js,而不是 vfox 的。

不管是哪个工具放的,只要有 `node` 排在 vfox 前面,`vfox use nodejs@<version>` 就会给出警告。未发布:0.5.4 会由插件打印下面的 `Note:`;在 vfox 1.1.0 及以后的版本里,这条警告由 vfox 自己打印,并附带插件的提示。
不管是哪个工具放的,只要有 `node` 排在 vfox 前面,`vfox use nodejs@<version>` 就会给出警告。在 vfox 1.1.0 及以后的版本里,这条警告由 vfox 自己打印,并附带插件的提示;在更早的 vfox 里,插件打印下面的 `Note:`。

在 vfox 1.1.0 及以后的版本里:

Expand Down
4 changes: 2 additions & 2 deletions docs/zh-CN/scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

这个插件给 vfox 提供的,正是 [nvm-sh/nvm](https://github.com/nvm-sh/nvm) 给 POSIX Shell 提供的东西:多个 Node.js 版本并存,可以为一个 Shell、一个项目选定其中一个,或者设为默认,并且能读取 `.nvmrc` 文件。nvm-sh/nvm 是一组 Shell 函数。它的 README 列出的是 Unix、macOS 和 WSL 上的 sh、dash、ksh、zsh 和 bash,另外在某些情况下也可以用于 Git Bash 和 Cygwin,其他 Windows 用户则被指向别的工具。PowerShell 不在这个列表里。vfox 是一个程序,为每种 Shell 都提供挂载脚本,所以同样的事情既可以在 Windows 10 和 11 自带的 Windows PowerShell 5.1 里做,也可以在 PowerShell 7、bash、zsh 和 fish 里做。

下面每个场景都写明你想做什么、要输入什么、会看到什么。输出取自 2026-11-03 的 Linux x64,使用 vfox 1.0.13 和后来成为 0.5.4 的代码,主目录一律写成 `/home/me`。PowerShell 的命令在 Linux 上的 PowerShell 7.6.9 里运行过,只有 Windows 独有的除外:`Set-ExecutionPolicy`,以及写入用户级环境变量的 `[Environment]::SetEnvironmentVariable`。Windows PowerShell 5.1 本身不在测试套件里(见 [platforms.md](platforms.md#ci-覆盖什么)),所以凡是依据 PowerShell 的文档或 vfox 的源码、而没有在那里实际运行过的内容,场景里都会注明。
下面每个场景都写明你想做什么、要输入什么、会看到什么。输出取自 2026-11-03 的 Linux x64,使用 vfox 1.0.13 和后来成为 0.5.5 的代码,主目录一律写成 `/home/me`。PowerShell 的命令在 Linux 上的 PowerShell 7.6.9 里运行过,只有 Windows 独有的除外:`Set-ExecutionPolicy`,以及写入用户级环境变量的 `[Environment]::SetEnvironmentVariable`。Windows PowerShell 5.1 本身不在测试套件里(见 [platforms.md](platforms.md#ci-覆盖什么)),所以凡是依据 PowerShell 的文档或 vfox 的源码、而没有在那里实际运行过的内容,场景里都会注明。

## 从 nvm 迁移

Expand Down Expand Up @@ -74,7 +74,7 @@
```

如果 `vfox use --session` 打印了这一行,说明配置文件没有运行:要么是第 1 步的执行策略,要么是挂载那一行写在了另一个 PowerShell 的配置文件里。
- 只有 `PATH` 里的第一个 `node` 会运行。nodejs.org 的安装程序、winget 或 Scoop 装的,或者另一个版本管理器的,都可能排在 vfox 前面。这时 `vfox use` 会打印一条提示,指出是哪一个,并说明它排在 vfox 前面,见 [pnpm.md](pnpm.md)。请卸载另一个。
- 只有 `PATH` 里的第一个 `node` 会运行。nodejs.org 的安装程序、winget 或 Scoop 装的,或者另一个版本管理器的,都可能排在 vfox 前面。这时 `vfox use` 会给出警告:在 vfox 1.1.0 及以后的版本里由 vfox 自己给出,并附带插件的提示,在更早的 vfox 里由插件打印一条提示,指出是哪一个,并说明它排在 vfox 前面,见 [pnpm.md](pnpm.md)和 [managers.md](managers.md)。请卸载另一个,或者用 `vfox link --detect nodejs` 把它链进来。
- Windows PowerShell 5.1 用 `>` 写出的 `.nvmrc` 是 UTF-16,插件能读它,见[下文](#在-windows-powershell-51-里写这个文件)。

## 全团队使用同一个 Node.js
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/source-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ vfox add nodejs

需要尚未发布的内容(`main` 分支,或者检出的某个 PR)时,就从源码安装:把检出的代码打包成 zip,交给 `vfox add --source`。zip 的顶层必须有 `metadata.lua`、`hooks/` 和 `lib/`,这是插件包的约定(见[共享工作流文档](https://github.com/version-fox/plugin-manifest-action))。

已发布的插件 zip 的 URL 也可以用作 `--source`,例如 `vfox add --source https://github.com/version-fox/vfox-nodejs/releases/download/v0.5.4/vfox-nodejs-0.5.4.zip`。
已发布的插件 zip 的 URL 也可以用作 `--source`,例如 `vfox add --source https://github.com/version-fox/vfox-nodejs/releases/download/v0.5.5/vfox-nodejs-0.5.5.zip`。

所有系统都需要事先装好 [vfox](https://github.com/version-fox/vfox) 本身和 `git`。

Expand Down
Loading
Loading