fix(install): require Node >=20.19/22.12 for the desktop build - #38255
Conversation
The "Build desktop app" install step failed with an opaque "exit code 1" on machines with an old Node, and nothing in the logs explained it. Reproduced: on Node 20.5.1, `npm run pack`'s `vite build` crashes with You are using Node.js 20.5.1. Vite requires Node.js version 20.19+ or 22.12+. SyntaxError: The requested module 'node:util' does not provide an export named 'styleText' Vite 8 (rolldown) imports node:util.styleText, which doesn't exist before Node 20.12, so the build dies before producing the app. The installer's check_node / Test-Node accepted ANY pre-existing Node with no version floor, so a too-old system Node was used for the build instead of the bundled Node 22. Add a version floor (^20.19 || >=22.12) to check_node (install.sh) and Test-Node (install.ps1): a too-old system Node is replaced with the Hermes-managed Node 22 LTS, and the desktop stage re-resolves Node so the build always runs on a satisfying version. Declare the same range in apps/desktop/package.json engines. Verified: build succeeds on Node 22, fails on 20.5.1 with the error above; the floor logic matches Vite's range across boundary versions (20.18/20.19, 21.x, 22.11/22.12).
🔎 Lint report:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the install scripts to enforce a minimum Node.js version required by the desktop build (Vite ^8), reducing opaque build failures on older Node versions.
Changes:
- Add Node version “floor” checks (
^20.19 || >=22.12) and prefer/install a Hermes-managed Node when the system Node is too old. - Make desktop install stages re-resolve Node in each stage/process to avoid relying on prior stage state.
- Declare the desktop app’s Node engine requirement in
apps/desktop/package.json.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| scripts/install.sh | Adds Node version gating + forces re-check before desktop build to avoid Vite-on-old-Node failures. |
| scripts/install.ps1 | Adds version gating and re-checks Node in desktop stage across separate PowerShell processes. |
| apps/desktop/package.json | Declares Node engine requirement matching Vite’s supported Node range. |
Comments suppressed due to low confidence (1)
scripts/install.sh:1
node --version(and the Hermes-managed equivalent) is invoked multiple times in the same branch. Capture the version once into a local variable and reuse it for bothnode_satisfies_buildand logging to avoid redundant subprocess calls and make the logic easier to read.
#!/bin/bash
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| check_node() { | ||
| log_info "Checking Node.js (for browser tools)..." | ||
|
|
||
| if command -v node &> /dev/null; then | ||
| local found_ver=$(node --version) | ||
| log_success "Node.js $found_ver found" | ||
| if command -v node &> /dev/null && node_satisfies_build "$(node --version)"; then |
| if command -v node &> /dev/null && node_satisfies_build "$(node --version)"; then | ||
| log_success "Node.js $(node --version) found" |
| if (Get-Command node -ErrorAction SilentlyContinue) { | ||
| $version = node --version | ||
| Write-Success "Node.js $version found" | ||
| $script:HasNode = $true | ||
| return $true | ||
| if (Test-NodeVersionOk $version) { |
| if ((Test-Path $managedNode) -and (Test-NodeVersionOk (& $managedNode --version))) { | ||
| $version = & $managedNode --version |
…desktop-build-logging fix(install): require Node >=20.19/22.12 for the desktop build
|
Thank you @OutThisLife for the quick fix! This was exactly the issue I was encountering. The version floor check properly catches the Node 22.11.0 incompatibility now. Really appreciate the detailed PR and quick merge. |
…d-logging fix(install): require Node >=20.19/22.12 for the desktop build
…desktop-build-logging fix(install): require Node >=20.19/22.12 for the desktop build
…desktop-build-logging fix(install): require Node >=20.19/22.12 for the desktop build
…desktop-build-logging fix(install): require Node >=20.19/22.12 for the desktop build
…desktop-build-logging fix(install): require Node >=20.19/22.12 for the desktop build
…desktop-build-logging fix(install): require Node >=20.19/22.12 for the desktop build
Summary
The "Build desktop app" install step fails with an opaque
exit code 1on machines with an old Node (reported on Apple Silicon by @Pixo14 / others). I reproduced the exact failure rather than guessing.Reproduced — same repo, same deps, only Node version changed:
npm run build(tsc + vite)exit code 1On v20.5.1:
Root cause. Vite 8 (via rolldown) imports
styleTextfromnode:util, which doesn't exist before Node 20.12 — sovite buildhard-crashes before producing the app. It dies right afterwrite-build-stamp/stage-native-deps, matching the reporter's screenshot. The installer accepted any pre-existing Node with no version floor:Test-Nodeininstall.ps1had the identical gap. So a too-old system Node was used for the build instead of the bundled Node 22.Fix
^20.19 || >=22.12) tocheck_node(install.sh) andTest-Node(install.ps1). A too-old system Node is replaced with the Hermes-managed Node 22 LTS the installer already knows how to fetch.npmwas entirely missing, so an old system Node slipped through)."engines": { "node": "^20.19.0 || >=22.12.0" }inapps/desktop/package.json.Test plan
npm run buildstill green on Node 22 after the changebash -n scripts/install.shcleannode_satisfies_buildfloor across boundary versions — rejects 18.x / 20.5.1 / 20.18.9 / 21.7.0 / 22.11.0; accepts 20.19 / 20.20 / 22.12 / 22.22 / 24.0install.ps1not run — nopwshon my machine; the PowerShell mirrors the bash logic 1:1 but needs a Windows/old-Node run to confirmScope note
This fixes the build failure itself. It does not touch the separate "the failure produced no readable log" diagnosability issue — intentionally kept out of scope.