Skip to content

fix(installer): Node version check fails under Windows PowerShell 5.1 - #8235

Open
JohnMcLear wants to merge 3 commits into
developfrom
fix/8214-installer-ps1-node-version
Open

JohnMcLear wants to merge 3 commits into
developfrom
fix/8214-installer-ps1-node-version

Conversation

@JohnMcLear

Copy link
Copy Markdown
Member

Fixes #8214

Root cause

Not the pnpm 12 pnpm ls --no-production crash fixed in #8232/3.3.5, which is a different failure. The Windows installer checked the Node version with:

$nodeMajor = [int](node -p 'process.versions.node.split(".")[0]')

Windows PowerShell 5.1, the default PS C:\> shell on Windows 10/11 and the one installer.ps1 declares support for via #Requires -Version 5.1, strips embedded double quotes when it passes arguments to native executables. So node received process.versions.node.split(.)[0] and threw a SyntaxError. The empty output cast to 0, so the installer aborted with Node.js >= 24 required. You have v26.8.2. for every Node version. PowerShell 7 (pwsh) passes the quotes correctly. CI only ran the installer under pwsh, so this never showed up there.

Fix

  • bin/installer.ps1: parse node --version (v24.15.0) with a PowerShell regex instead of passing a JS snippet to node -p. This removes the quoting problem entirely. If the version can't be parsed, the installer now says so instead of reporting a misleading "too old".
  • .github/workflows/installer-test.yml: the Windows end-to-end job is now a matrix over pwsh and powershell (Windows PowerShell 5.1). shell: can't take an expression, so the step is split per shell.

Tests / evidence

  • Before the fix (CI change only, commit 2): the new windows-latest, powershell leg failed with the exact error from the issue (run 35215567068):
    ==> Etherpad installer
    [eval]:1
    process.versions.node.split(.)[0]
    SyntaxError: Unexpected token '.'
    
  • After the fix: both Windows legs (pwsh and 5.1) run the full install, build and /api smoke test. See the checks on this PR.

No docs change is needed because the install command is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_0139nGyeFNACmifj6pRLSVRs

JohnMcLear and others added 3 commits September 17, 2026 12:14
Refs #8214.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139nGyeFNACmifj6pRLSVRs
…ression)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139nGyeFNACmifj6pRLSVRs
…l 5.1)

Windows PowerShell 5.1 strips embedded double quotes from native-command
arguments, so `node -p 'process.versions.node.split(".")[0]'` reached
node as split(.)[0], threw a SyntaxError, cast to 0, and aborted with
'Node.js >= 24 required' for any Node version.

Fixes #8214

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139nGyeFNACmifj6pRLSVRs
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix Node version detection in Windows PowerShell 5.1

🐞 Bug fix 🧪 Tests ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Parse Node version output without PowerShell 5.1 native-argument quoting issues.
• Report unparseable Node versions instead of misclassifying them as unsupported.
• Test Windows installation under PowerShell 7 and Windows PowerShell 5.1.
Diagram

graph TD
  CI["Windows CI"] --> Shells{"Shell matrix"} --> Installer["PowerShell installer"] --> Version["node --version"] --> Parse{"Version valid?"} --> Major{"Major >= 24?"} --> Build["Install and build"]
  Parse -- "No" --> Error["Version error"]
  Major -- "No" --> Error
Loading
High-Level Assessment

Parsing the stable node --version output in PowerShell is the most portable approach. Escaping or restructuring the previous node -p JavaScript expression would remain dependent on native-command argument behavior across PowerShell versions, while the regex removes that boundary entirely and enables a precise parse-failure message.

Files changed (2) +31 / -4

Bug fix (1) +9 / -2
installer.ps1Parse Node.js versions without native argument quoting +9/-2

Parse Node.js versions without native argument quoting

• Replaces the 'node -p' JavaScript expression with regex parsing of 'node --version', avoiding Windows PowerShell 5.1 quote stripping. Adds a specific fatal error when the returned version cannot be parsed and reuses the parsed version in minimum-version diagnostics.

bin/installer.ps1

Tests (1) +22 / -2
installer-test.ymlTest the Windows installer under both PowerShell implementations +22/-2

Test the Windows installer under both PowerShell implementations

• Expands the Windows end-to-end job into a matrix covering PowerShell 7 and Windows PowerShell 5.1. Separate conditional installer steps accommodate GitHub Actions' inability to use expressions in 'shell', while retaining shared build verification and API smoke testing.

.github/workflows/installer-test.yml

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failure with Etherpad installer

1 participant