openclaw - ✅(Solved) Fix [Bug]: pnpm ELF binary executed via Node.js in WSL due to npm_execpath misdetection [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63862Fetched 2026-04-10 03:41:45
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1labeled ×1

After upgrading from 2026.4.1 (da64a97) to 2026.4.9 (0512059), build from source failed in WSL; Reproducible Issue.

Root Cause

After upgrading from 2026.4.1 (da64a97) to 2026.4.9 (0512059), build from source failed in WSL; Reproducible Issue.

Fix Action

Fixed

PR fix notes

PR #63906: Handle native ELF binaries execution on WSL

Description (problem / solution / changelog)

Summary

  • Problem: On WSL with a standalone pnpm install, npm_execpath points to a native ELF binary. pnpm-runner.mjs detected it as a pnpm path and invoked it as node <elf-binary>, causing a SyntaxError: Invalid or unexpected token crash on every build.
  • Why it matters: The build is completely broken on WSL with standalone pnpm — no workaround short of reinstalling pnpm via npm/corepack.
  • What changed: resolvePnpmRunner in scripts/pnpm-runner.mjs now checks whether npm_execpath ends in .js or .cjs. If it does, it runs via node (existing behavior). If not (native binary), it executes the binary directly as the command.
  • What did NOT change: All other platforms are unaffected. Windows takes the win32 branch before this check. macOS and Linux npm/corepack installs still go through node. No build logic, config, or plugin SDK changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes #63862

Root Cause (if applicable)

  • Root cause: resolvePnpmRunner assumed any path matching the pnpm filename pattern could be run via node <path>. This holds for JS-based installs but breaks when the path is a native ELF binary, which Node.js cannot interpret as a script.
  • Missing detection / guardrail: No check on whether the resolved executable is a JS file vs. a native binary before choosing the invocation strategy.
  • Contributing context: pnpm's standalone Linux installer distributes a native ELF binary (via @pnpm/exe). When pnpm runs a script, it sets npm_execpath to this binary's path. Node v24 no longer silently ignores the parse error — it throws immediately.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: scripts/pnpm-runner.test.mjs (new or existing)
  • Scenario the test should lock in: When npmExecPath matches the pnpm pattern but has no .js/.cjs extension, resolvePnpmRunner must return the binary path as command, not as an arg to nodeExecPath.
  • Why this is the smallest reliable guardrail: Pure unit test on the resolver function — no process spawning needed, no platform dependency.
  • Existing test that already covers this: None.
  • If no new test is added, why not: N/A — test should be added.

User-visible / Behavior Changes

Build no longer crashes on WSL with a standalone pnpm install. No other user-visible change.

Diagram (if applicable)

Before:
[pnpm runs build] -> npm_execpath=/path/to/pnpm (ELF)
                  -> node /path/to/pnpm (ELF) -> SyntaxError crash

After:
[pnpm runs build] -> npm_execpath=/path/to/pnpm (ELF)
                  -> isJsScript = false
                  -> exec /path/to/pnpm directly -> success

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No — the same binary is invoked; only the invocation method changes (direct exec vs. node wrapper).
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: Ubuntu 24 on WSL2 (Windows host)
  • Runtime/container: Node.js v24.14.1
  • Model/provider: N/A
  • Integration/channel (if any): N/A
  • Relevant config (redacted): pnpm 10.33.0 standalone install (~/.local/share/pnpm/pnpm)

Steps

  1. Install pnpm via standalone installer on WSL2
  2. Run pnpm build from repo root
  3. Observe SyntaxError: Invalid or unexpected token at @pnpm+exe/.../pnpm:1

Expected

  • Build completes successfully

Actual

  • Build crashes immediately with Node.js trying to parse ELF binary as JS

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: pnpm build completes on WSL2 with standalone pnpm after the fix.
  • Edge cases checked: macOS (corepack install), Linux npm install — both follow existing code path unchanged. Windows not applicable (separate branch).
  • What you did not verify: macOS standalone pnpm install (Mach-O binary path).

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Risks and Mitigations

  • Risk: macOS standalone install ships a Mach-O binary with no .js extension — would take the new direct-exec path. If pnpm previously worked on macOS standalone via the node path (unlikely), this could regress it.
    • Mitigation: macOS standalone pnpm installs were already broken by the same logic if npm_execpath was set — direct exec is strictly more correct for native binaries on any platform.

Changed files

  • scripts/pnpm-runner.mjs (modified, +17/-5)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After upgrading from 2026.4.1 (da64a97) to 2026.4.9 (0512059), build from source failed in WSL; Reproducible Issue.

Steps to reproduce

  1. Checkout v2026.4.9 (0512059).
  2. pnpm install && pnpm ui:build && pnpm build

Expected behavior

Build expected success as following:

<img width="971" height="1067" alt="Image" src="https://github.com/user-attachments/assets/e9259ea6-e684-4515-a719-88fab04d6883" />

Actual behavior

<img width="1644" height="926" alt="Image" src="https://github.com/user-attachments/assets/1844c9e3-e0ec-4cf2-b9b7-d6ecaab5d391" />

OpenClaw version

2026.4.9

Operating system

Windows 11 WSL version: 2.6.3.0

Install method

pnpm install && pnpm ui:build && pnpm build

Model

N/A

Provider / routing chain

N/A

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: Users install/update from source on WSL 2 with 2026.4.9 Severity: Low Frequency: 3/3 observed attempts

Additional information

No response

extent analysis

TL;DR

Downgrade to version 2026.4.1 (da64a97) to potentially resolve the build failure issue in WSL.

Guidance

  • Verify that the issue is specific to version 2026.4.9 (0512059) by attempting to build with previous versions.
  • Check the compatibility of WSL version 2.6.3.0 with the upgraded version 2026.4.9.
  • Attempt to build with a different package manager or installation method to isolate the issue.
  • Review the build logs and output for any specific error messages that may indicate the cause of the failure.

Notes

The provided information does not include specific error messages or logs, which may be necessary to determine the root cause of the issue.

Recommendation

Apply workaround: Downgrade to version 2026.4.1 (da64a97) as it is known to work, while investigating the compatibility issues with version 2026.4.9.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Build expected success as following:

<img width="971" height="1067" alt="Image" src="https://github.com/user-attachments/assets/e9259ea6-e684-4515-a719-88fab04d6883" />

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING