You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
devEngines.runtime.version: "lts/*" is accepted without a warning #2882
Rule: Vite+ is lenient when **reading** (`devEngines.runtime.version` containing an alias still resolves, with a doctor warning about spec non-compliance) but strict when **writing** (only valid semver ranges or exact versions are ever written to `devEngines`).
Not sure if it is better to have a stricter check. (The current behavior is introduced in #1760), cc @fengmk2
Thanks, I misread the RFC. Aliases still resolve, with only a doctor warning (confirmed in v1.0.0).
My concern is the lenient-read rule itself:
Inconsistent: vp env default lts and lts/* both resolve to the latest LTS, but in devEngines bare lts is ignored with a warning while lts/* resolves silently.
Not portable: npm and pnpm reject lts/*, so a project that works with vp fails on install.
npm: EBADDEVENGINES Invalid version "lts/*" does not match "v24.21.0" for "runtime"
pnpm: ERR_PNPM_BAD_RUNTIME_VERSION This project requires an invalid Node.js version range: lts/*
Would it make sense to handle lts/* like lts (warn and ignore at resolve time)?
Thanks for clarifying. I agree we should revise the RFC’s lenient-read rule here.
npm documents devEngines.runtime, and the OpenJS proposal specifies the same version syntax as engines.node. We should accept semver versions and ranges in this field, without interpreting lts, lts/*, or latest as aliases.
For the explicit onFail: "error" in this example, npm and pnpm both fail. Vite+ should also report an error instead of resolving the alias or silently falling back. A warning only in vp env doctor does not address the portability problem.
Aliases can remain supported in CLI inputs such as vp env pin lts, which resolves them to an exact version before writing devEngines.runtime.version.
Unit Test: Yes — added/updated tests in crates/vp_js_runtime/src/runtime.rs and crates/vp_global_cli/src/commands/env/config.rs
Priority:P3: Minor Bug. This is an edge case that only affects projects putting non-semver aliases such as lts/* or latest into devEngines.runtime.version, and the workaround is to use a proper semver exact version or range.
normalize_version / is_valid_version in crates/vp_js_runtime/src/runtime.rs treat LTS aliases (lts/*, lts/iron, latest, etc.) as valid version specs for every source. The devEngines.runtime resolution path in both vp_js_runtime::download_runtime_for_project and vp_global_cli::resolve_project_version_source uses that generic validation, so aliases are silently resolved instead of being rejected per the devEngines spec. Bare lts only warns because it matches neither an alias pattern nor a semver range.
I found a potential fix for this issue. The branch adds source-aware strict semver validation for devEngines.runtime.version, rejects aliases, and respects the effective onFail (error → fail, warn/download → warn and fall through, ignore → silent fall through). CLI inputs like vp env pin lts and non-manifest sources like .node-version/.nvmrc continue to accept aliases.
Full Triage Report
Reproduction
Created an isolated VP_HOME with vp env default node@22 and a package.json containing devEngines.runtime.version: "lts/*" with onFail: "error". vp env current resolved the alias to the latest LTS (26.13.1) with source devEngines.runtime and emitted no warning. Switching to bare "lts" printed warning: invalid version 'lts' in devEngines.runtime, ignoring and fell back to the default.
Root cause
crates/vp_js_runtime/src/runtime.rs has a single is_valid_version/ normalize_version path that accepts aliases for all sources.
download_runtime_for_project and vp_global_cli::resolve_project_version_source call this path for devEngines.runtime, so lts/* is accepted and later resolved via NodeProvider::resolve_lts_alias.
onFail was not being consulted for runtime invalid values.
Fix branch
triagebot/fix-2882:
Adds is_valid_semver_version and validate_dev_engines_runtime_version in crates/vp_js_runtime/src/runtime.rs.
Adds InvalidDevEnginesRuntimeVersion error variant in crates/vp_js_runtime/src/error.rs.
Applies strict validation in download_runtime_for_project and resolve_project_version_source.
Updates rfcs/dev-engines.md to reflect the strict read rule.
Adds unit tests covering alias rejection, onFail: error failure, and fallback behavior.
Validation
Reproduction re-run with the branch binary: vp env current now errors with devEngines.runtime.version "lts/*" is not a valid semver range (see devEngines spec) for onFail: error, and warns/falls back to the default for onFail: warn.
.node-version with lts/* still resolves correctly.
just check and just test pass.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
Activity
liangmiQwQ commentedon Oct 4, 2026
Hello, this is actually a behavior follows RFC, where
lts/*could be parsed but would be treated as invalid invp env doctor.vite-plus/rfcs/dev-engines.md
Line 200 in 5290951
Not sure if it is better to have a stricter check. (The current behavior is introduced in #1760), cc @fengmk2
hyunbinseo commentedon Oct 4, 2026
Thanks, I misread the RFC. Aliases still resolve, with only a doctor warning (confirmed in v1.0.0).
My concern is the lenient-read rule itself:
vp env default ltsandlts/*both resolve to the latest LTS, but indevEnginesbareltsis ignored with a warning whilelts/*resolves silently.lts/*, so a project that works withvpfails on install.EBADDEVENGINES Invalid version "lts/*" does not match "v24.21.0" for "runtime"ERR_PNPM_BAD_RUNTIME_VERSION This project requires an invalid Node.js version range: lts/*Would it make sense to handle
lts/*likelts(warn and ignore at resolve time)?chore(deps): update rust crates (#1780)
fengmk2 commentedon Nov 16, 2026
Thanks for clarifying. I agree we should revise the RFC’s lenient-read rule here.
npm documents
devEngines.runtime, and the OpenJS proposal specifies the same version syntax asengines.node. We should accept semver versions and ranges in this field, without interpretinglts,lts/*, orlatestas aliases.For the explicit
onFail: "error"in this example, npm and pnpm both fail. Vite+ should also report an error instead of resolving the alias or silently falling back. A warning only invp env doctordoes not address the portability problem.Aliases can remain supported in CLI inputs such as
vp env pin lts, which resolves them to an exact version before writingdevEngines.runtime.version.voidzero-bot commentedon Nov 18, 2026
crates/vp_js_runtime/src/runtime.rsandcrates/vp_global_cli/src/commands/env/config.rslts/*orlatestintodevEngines.runtime.version, and the workaround is to use a proper semver exact version or range.normalize_version/is_valid_versionincrates/vp_js_runtime/src/runtime.rstreat LTS aliases (lts/*,lts/iron,latest, etc.) as valid version specs for every source. ThedevEngines.runtimeresolution path in bothvp_js_runtime::download_runtime_for_projectandvp_global_cli::resolve_project_version_sourceuses that generic validation, so aliases are silently resolved instead of being rejected per the devEngines spec. Bareltsonly warns because it matches neither an alias pattern nor a semver range.I found a potential fix for this issue. The branch adds source-aware strict semver validation for
devEngines.runtime.version, rejects aliases, and respects the effectiveonFail(error→ fail,warn/download→ warn and fall through,ignore→ silent fall through). CLI inputs likevp env pin ltsand non-manifest sources like.node-version/.nvmrccontinue to accept aliases.Full Triage Report
Reproduction
Created an isolated
VP_HOMEwithvp env default node@22and apackage.jsoncontainingdevEngines.runtime.version: "lts/*"withonFail: "error".vp env currentresolved the alias to the latest LTS (26.13.1) with sourcedevEngines.runtimeand emitted no warning. Switching to bare"lts"printedwarning: invalid version 'lts' in devEngines.runtime, ignoringand fell back to the default.Root cause
crates/vp_js_runtime/src/runtime.rshas a singleis_valid_version/normalize_versionpath that accepts aliases for all sources.download_runtime_for_projectandvp_global_cli::resolve_project_version_sourcecall this path fordevEngines.runtime, solts/*is accepted and later resolved viaNodeProvider::resolve_lts_alias.onFailwas not being consulted for runtime invalid values.Fix branch
triagebot/fix-2882:is_valid_semver_versionandvalidate_dev_engines_runtime_versionincrates/vp_js_runtime/src/runtime.rs.InvalidDevEnginesRuntimeVersionerror variant incrates/vp_js_runtime/src/error.rs.download_runtime_for_projectandresolve_project_version_source.rfcs/dev-engines.mdto reflect the strict read rule.onFail: errorfailure, and fallback behavior.Validation
vp env currentnow errors withdevEngines.runtime.version "lts/*" is not a valid semver range (see devEngines spec)foronFail: error, and warns/falls back to the default foronFail: warn..node-versionwithlts/*still resolves correctly.just checkandjust testpass.This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
I've opened a pull request with this fix: #3489
fix(env): reject aliases in devEngines.runtime.version (#3489)