Repository navigation
vp env exec / vp node ignore nodeShimMode: system_first, download a managed runtime (~192 MB) that vp env clean then refuses to remove #3093
Description
Summary
With nodeShimMode: system_first, vite-plus correctly resolves Node.js to the system runtime for the shims and for vp env current / vp env which. The vp env exec family -- which vp node is a shorthand for -- does not honour that preference: it resolves and downloads a vite-plus managed Node runtime instead.
This is not a matter of preference between two managed versions. It is a divergence between what vite-plus reports and what it dispatches, plus disk growth on a machine that explicitly opted out of Node management.
Expected vs actual
Configuration:
{
"nodeShimMode": "system_first",
"packageManagerShimModes": { "bun": "system_first", "npm": "system_first",
"pnpm": "system_first", "yarn": "system_first" }
}What agrees with system_first:
$ node -v
v26.11.1
$ vp env which node
/usr/bin/node
$ vp env current
Node.js:
Version 26.11.1
Source system PATH
Bin Path /usr/bin/node
Mode system_first
What does not:
$ vp node -v
v24.22.0
$ vp env exec node -v
v24.22.0
vp env exec --help states:
--node <NODE>Node.js version to use (e.g., "20.18.0", "lts", "^20.0.0"). If omitted and command is node/npm/npx or a global package binary, version is resolved automatically (same as shim behavior)
The shim resolves to the system Node, so env exec is not resolving "the same as shim behavior".
Reproduction
Deterministic container, Docker or Podman:
https://gist.github.com/Kat404/0c2bf9a8f0a6942f216a827098e3a24d
podman build -t vp-sysfirst-exec .
podman run --rm vp-sysfirst-execCASE A: DIVERGENCE CONFIRMED shim=v20.19.2 vp-node=v24.22.0
CASE B: 201708991 bytes on disk under js_runtime/node
CASE C: inventory tracks it as: * v24.22.0 current
CASE D: inventory does record it, so uninstall (not clean) is the only removal
CASE E: vp env clean -> ✓ Removed 0 Node.js runtimes
The build fails if the divergence does not reproduce.
Manually, without a container:
vp env off node
vp env off pm
mkdir -p /tmp/repro && cd /tmp/repro
printf '{\n "name": "repro",\n "version": "1.0.0",\n "private": true\n}\n' > package.json
node -v # system version
vp env which node # /usr/bin/node
vp node -v # vite-plus managed versionConsequences
-
Unwanted download. Running
vp node(orvp env exec node) materialises a managed runtime of roughly 190-220 MB on a machine configured to use the system Node. -
vp env cleancannot reclaim it. Once downloaded, the runtime is recorded as the current version:
$ vp env list
Node.js
* v24.22.0 current
$ vp env clean
✓ Removed 0 Node.js runtimes
Per the docs, vp env clean preserves the current and configured-default versions. So the space comes back every time a project invokes vp node, and the only removal is the explicit vp env uninstall 24.22.0.
- Confusing state.
vp env listreports* v24.22.0 currentwhilevp env currentreports the system26.11.1as the resolved environment. Two commands, two different "current" Node runtimes.
Possible fixes
- Resolve
env execthrough the same path the shims use, sonodeShimMode: system_firstapplies to it too. - Or: when a runtime is materialised only as an
env execfallback while the environment is system-first, do not record it as the current install, sovp env cleancan remove it.
Related, not duplicates
- Concurrent
vp run devprocesses download the same Node.js runtime twice #2642 - Concurrentvp run devprocesses download the same Node.js runtime twice. Same subsystem, different symptom. nodeshim loops forever in system-first mode when the systemnodeis a mise shim (vp and shellnodehang) #2728 -nodeshim loops forever in system-first mode when the systemnodeis a mise shim. Same mode, different failure.- Separate
system-firstshims from binary directory #2746 / feat(env): separate system-first shims from the main bin directory #2758 - Separatesystem-firstshims from the main bin directory (merged; this is whybin/now holds onlyvp,vpr,vpxand the rest live infallback-bin/, appended to PATH).
Environment
- vite-plus v1.3.0 (
vp upgrade --checkreports already up to date) - Arch Linux, kernel 6.x
- System Node.js: v26.11.1 at
/usr/bin/node(pacmannodejs) - Container repro: debian:stable-slim with Debian
nodejsv20.19.2 at/usr/bin/node, vite-plus installed viacurl -fsSL https://vite.plus | bash - Podman 6.1.4
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Effort
Target date
Start date
Activity
Kat404 commentedon Oct 16, 2026
Follow-up: command-by-command matrix, and a distinction that may localise the bug
I ran the full project command surface in a disposable sandbox with Vite+ 1.3.0 installed through the system package manager, and fingerprinted the runtime each command actually uses instead of inferring it from disk usage.
A Vite plugin with
buildStart()printingprocess.versionandprocess.execPathgives a definitive runtime fingerprint:Results
system_firstvp devv26.11.1(/usr/bin/node)vp buildv26.11.1(/usr/bin/node)vp run <task>v26.11.1(/usr/bin/node)vp testvp lintvp previewvp exec node -vv26.11.1vp env exec node -vv24.22.0(managed)vp node -vv24.22.0(managed)Nothing was downloaded by any of the honouring commands:
js_runtimestayed at 220394524 bytes andindex_cache.jsonnever changed mtime across the whole run.The detail that may matter most
vp execandvp env execare similarly named commands with opposite resolution behaviour:vp execruns a binary from localnode_modules/.binand used the system Node.vp env execruns a command in the resolved environment and used the managed Node.That narrows the search considerably: the shim resolution path used by
vp dev,vp buildandvp runalready honourssystem_firstcorrectly, so the divergence is specific to the environment-resolution branch reached fromvp env execand itsvp nodeshorthand.Correction to a related issue
I previously read #2642 ("Concurrent
vp run devprocesses download the same Node.js runtime twice") as suggesting thatvp runmaterialises a managed runtime. That is not reproducible insystem_firstmode:vp runcompleted a task that reportednode=v26.11.1 execPath=/usr/bin/nodeand left the store untouched. #2642 presumably covers a managed-mode or first-run scenario.One extra observation
When a runtime download is interrupted,
vpleaves its temporary directory behind:Two partial tarballs, 18 MB, never reclaimed, even after
vp env uninstall. This looks like the same class as #1949 ("clean up the temp dir when a package-manager install fails"), but on thejs_runtimepath rather than the package-manager path.Workaround confirmed
Avoiding
vp nodeandvp env execentirely keeps the managed runtime out of the picture. When it does land,vp env cleanwill not remove it, because it is recorded as current:Environment
Same as the original report: Vite+ v1.3.0, Arch Linux, system Node.js v26.11.1,
nodeShimMode: system_first, all package-manager shims alsosystem_first. Sandbox: Debiannodejsv20.19.2 at/usr/bin/node, Vite+ installed via the documentedcurl -fsSL https://vite.plus | bash.liangmiQwQ commentedon Oct 17, 2026
It seems introduced in #2758. I'll find a way to fix.
fix(env): honor system-first mode in `vp env exec` and `vp node` (voi…