Skip to content

The agent that grows with you

fix(dashboard): align supported Node engine lines

fangliquan4a7df1d070e9
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index 1ecf88c71ba..d3f83697315 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -12,7 +12,7 @@
"type": "module",
"main": "dist/electron-main.mjs",
"engines": {
- "node": ">=22.22.0"
+ "node": "^22.22.0 || ^24.0.0 || >=26.0.0"
},
"scripts": {
"clean": "npm run clean:e2e && npm run clean:renderer && npm run clean:electron",
diff --git a/package-lock.json b/package-lock.json
index 8f81bc01af8..a4a28152905 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -25,7 +25,7 @@
"typescript-eslint": "8.64.0"
},
"engines": {
- "node": ">=22.22.0",
+ "node": "^22.22.0 || ^24.0.0 || >=26.0.0",
"npm": "<11.10.0 || >=11.17.0"
}
},
@@ -171,7 +171,7 @@
"wait-on": "9.0.10"
},
"engines": {
- "node": ">=22.22.0"
+ "node": "^22.22.0 || ^24.0.0 || >=26.0.0"
},
"optionalDependencies": {
"get-windows": "9.3.0"
diff --git a/package.json b/package.json
index bbc401ab9ad..aa68df6bed0 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
"tar": "7.5.22"
},
"engines": {
- "node": ">=22.22.0",
+ "node": "^22.22.0 || ^24.0.0 || >=26.0.0",
"npm": "<11.10.0 || >=11.17.0"
},
"allowScripts": {
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index 0c12bf8a62d..93a5933d834 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -1643,11 +1643,10 @@ function Set-GitBashEnvVar {
Write-Info "If needed, set HERMES_GIT_BASH_PATH manually to your bash.exe path."
}
-# The dependency tree's real Node floor is >=22.22.0, set by react-router 8.3.0
-# (`engines.node`). Keep this in sync with the root package.json: looser lets an
-# install reach a `npm ci` that dies with EBADENGINE, stricter replaces a working
-# user toolchain for nothing. Returns $true when a `node --version` string
-# clears that floor.
+# The dependency tree supports Node 22.22+, 24, and 26+. nanoid 6 deliberately
+# excludes odd-numbered Node releases, so accepting Node 23/25 here only defers
+# the failure to `npm ci` under engine-strict. Keep this in sync with the root
+# package.json.
function Test-NodeVersionOk {
param([string]$Version)
try {
@@ -1656,7 +1655,7 @@ function Test-NodeVersionOk {
return $false
}
if ($v.Major -eq 22) { return ($v.Minor -ge 22) }
- return ($v.Major -gt 22)
+ return (($v.Major -eq 24) -or ($v.Major -ge 26))
}
# Accept a system Node only when its companion npm also satisfies the same
diff --git a/scripts/install.sh b/scripts/install.sh
index 3e00f887625..38c7a03b609 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -882,20 +882,19 @@ check_cxx_compiler() {
return 1
}
-# The dependency tree's real Node floor is >=22.22.0, set by react-router 8.3.0
-# (`engines.node`), with Vite ^8 next at `^20.19 || >=22.12`. Keep this in sync
-# with the root package.json — a gate looser than the manifest lets an install
-# proceed to a `npm ci` that then dies with EBADENGINE, and a gate stricter than
-# the manifest replaces a working user toolchain for nothing. Returns 0 when the
-# given `node --version` string clears the floor; anything below it is replaced
-# with the Hermes-managed Node $NODE_VERSION.
+# The dependency tree supports Node 22.22+, 24, and 26+. nanoid 6 deliberately
+# excludes odd-numbered Node releases, so accepting Node 23/25 here only defers
+# the failure to `npm ci` under engine-strict. Keep this in sync with the root
+# package.json. Anything outside the supported lines is replaced with the
+# Hermes-managed Node $NODE_VERSION.
node_satisfies_build() {
local ver="${1#v}"
local major="${ver%%.*}"
local minor="${ver#*.}"; minor="${minor%%.*}"
case "$major" in ''|*[!0-9]*) return 1 ;; esac
case "$minor" in ''|*[!0-9]*) minor=0 ;; esac
- if [ "$major" -ge 22 ] && { [ "$major" -gt 22 ] || [ "$minor" -ge 22 ]; }; then return 0; fi
+ if [ "$major" -eq 22 ] && [ "$minor" -ge 22 ]; then return 0; fi
+ if [ "$major" -eq 24 ] || [ "$major" -ge 26 ]; then return 0; fi
return 1
}
diff --git a/tests/test_engines_satisfiable.py b/tests/test_engines_satisfiable.py
index e150765de6d..df610301e74 100644
--- a/tests/test_engines_satisfiable.py
+++ b/tests/test_engines_satisfiable.py
@@ -19,7 +19,6 @@ declare and the toolchain that has to satisfy it.
from __future__ import annotations
import json
-import re
from pathlib import Path
import pytest
@@ -117,15 +116,11 @@ class TestEnginesAreSatisfiable:
else: # pragma: no cover - install.sh always defines it
pytest.fail("install.sh does not define NODE_VERSION")
- # install.sh fetches latest-v{major}.x, not {major}.0.0, so compare on
- # the major: the newest release of that line must be able to clear the
- # floor. A floor in a HIGHER major than we provision can never be met.
- floor_majors = [
- int(m.group(1))
- for m in re.finditer(r">=\s*v?(\d+)", node_range)
- ]
- assert floor_majors, f"cannot read a floor out of {node_range!r}"
- assert managed_major >= min(floor_majors), (
+ # install.sh fetches latest-v{major}.x, not {major}.0.0. Use a high
+ # representative release from that major so ranges that enumerate LTS
+ # lines (rather than one continuous floor) are checked correctly.
+ managed_release = f"{managed_major}.999.999"
+ assert _satisfies_range(managed_release, node_range), (
f"engines.node is {node_range!r} but install.sh provisions Node "
f"{managed_major}.x. The runtime we ship must satisfy the floor we "
"declare, or the install we just performed cannot install deps."
@@ -175,6 +170,21 @@ class TestEnginesAreSatisfiable:
"nothing."
)
+ @pytest.mark.parametrize("supported_node", ["22.22.0", "22.23.1", "24.0.0", "26.0.0"])
+ def test_root_range_accepts_supported_dependency_lines(self, supported_node):
+ node_range = _root_manifest()["engines"]["node"]
+ assert _satisfies_range(supported_node, node_range)
+
+ @pytest.mark.parametrize("unsupported_node", ["22.21.1", "23.0.0", "25.2.1"])
+ def test_root_range_rejects_nodes_excluded_by_dependencies(self, unsupported_node):
+ """The root preflight must reject a runtime nanoid 6 cannot run on."""
+ node_range = _root_manifest()["engines"]["node"]
+ assert not _satisfies_range(unsupported_node, node_range), (
+ f"engines.node {node_range!r} accepts Node {unsupported_node}, so "
+ "engine-strict defers the failure to nanoid instead of naming Hermes's "
+ "supported runtime range and provisioning a managed Node."
+ )
+
class TestExcludedNpmBand:
"""npm 11.10–11.16 honor `min-release-age` but ignore `min-release-age-exclude`.