GeezerVison is showing github.com — `devEngines.runtime.version: "lts/*"` is accepted without a warning · Issue #2882 · voidzero-dev/vite-plus
devEngines.runtime.version: "lts/*" is accepted without a warning #2882
DescriptionDescribe the bug
rfcs/dev-engines.md says LTS aliases are not valid in devEngines.runtime.version and should warn:
devEngines.runtime.version "lts/*" is not a valid semver range (see devEngines spec)
lts/* is silently resolved to the latest LTS instead. Bare lts is rejected as expected.
devEngines.runtime.version |
Result (default: 22.23.3) |
lts/* |
v24.21.0, no warning |
lts |
warning: invalid version 'lts' in devEngines.runtime, ignoring → v22.23.3 |
pnpm rejects both (ERR_PNPM_BAD_RUNTIME_VERSION), so a project that works with vp fails on pnpm install.
Reproduction
See steps below.
Steps to reproduce
mkdir repro && cd repro
echo '{ "devEngines": { "runtime": { "name": "node", "version": "lts/*", "onFail": "error" } } }' > package.json
vp env default node@22
node -v # v24.21.0, expected a warning and v22.23.3
System Info
$ vp env current
Node.js:
Version 24.21.0
Source devEngines.runtime
Bin Path /home/nodejs/.local/share/vite-plus/js_runtime/node/24.21.0/bin/node
Installed true
Mode managed
$ vp --version
vp v1.0.0
Used Package Manager
pnpm
Logs
No response
Validations
ActivityliangmiQwQ commented on Oct 4, 2026 Hello, this is actually a behavior follows RFC, where lts/* could be parsed but would be treated as invalid in vp env doctor.
|
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 hyunbinseo commented on Oct 4, 2026 ContributorAuthor More actions 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)? fengmk2 commented on 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 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. voidzero-bot commented on Nov 18, 2026
- Reproduced: Yes
- Exploration: Yes — View branch
- 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.
I've opened a pull request with this fix: #3489 added a commit that references this issue on Nov 20, 2026This issue will close once commit f095af5 is merged into the 'main' branch.f095af5
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|