-
-
Notifications
You must be signed in to change notification settings - Fork 69.6k
[Bug]: pnpm build fails on Windows — WSL bash invoked by pnpm cannot find node (scripts/bundle-a2ui.sh) #26065
Description
Summary
Running pnpm build on Windows fails immediately at the canvas:a2ui:bundle step because pnpm resolves bash to WSL's bash (C:\Windows\System32\bash.exe) rather than Git Bash, and WSL does not have Node.js installed natively — causing every node-dependent call inside scripts/bundle-a2ui.sh to fail.
Steps to reproduce
Prerequisites:
- Windows 11 with WSL2 installed (WSL's
bash.exeis present inSystem32) - Git Bash installed, Node.js 22+ on the Windows side (accessible in Git Bash)
- Node.js NOT installed inside WSL
- pnpm 10 installed globally
Steps:
- Clone the repository on Windows.
- Run
pnpm installfrom Windows cmd or PowerShell. - Run
pnpm buildfrom Windows cmd or PowerShell. - Observe the failure at the
canvas:a2ui:bundlestep.
Expected behavior
pnpm build completes successfully, or scripts/bundle-a2ui.sh detects the WSL environment and falls back gracefully to the prebuilt bundle — the same way it already handles Docker environments where sources are absent.
Actual behavior
The build fails with:
> [email protected] canvas:a2ui:bundle
> bash scripts/bundle-a2ui.sh
scripts/bundle-a2ui.sh: line 35: node: command not found
A2UI bundling failed. Re-run with: pnpm canvas:a2ui:bundle
After any workaround that makes compute_hash pass, a second failure emerges from pnpm's own shell wrapper also needing node:
/mnt/c/Users/<user>/AppData/Local/pnpm/.tools/pnpm/10.23.0/bin/pnpm: 15: exec: node: not found
A2UI bundling failed. Re-run with: pnpm canvas:a2ui:bundle
ELIFECYCLE Command failed with exit code 1.
Root cause chain:
- pnpm executes
bash scripts/bundle-a2ui.shfrom Windows cmd context. - Windows resolves
bashtoC:\Windows\System32\bash.exe, which opens WSL bash — not Git Bash. - Inside WSL bash,
nodeis not installed natively. scripts/bundle-a2ui.shcallsnode --input-type=moduleinsidecompute_hash()→node: command not found.- Even after patching
compute_hash, the subsequentpnpm -s exec tscandpnpm -s dlx rolldowncalls invoke pnpm's own shell wrapper, which also doesexec nodeinternally and fails for the same reason.
OpenClaw version
2026.2.22
Operating system
Windows 11 with WSL2 (Ubuntu). Node.js 24.13.1 on Windows/Git Bash; no node in WSL.
Install method
pnpm dev (source build from main branch)
Logs
D:\project\openclaw> pnpm build
> [email protected] canvas:a2ui:bundle
> bash scripts/bundle-a2ui.sh
# Failure 1 — node called directly in compute_hash (line 35):
scripts/bundle-a2ui.sh: line 35: node: command not found
A2UI bundling failed. Re-run with: pnpm canvas:a2ui:bundle
# Failure 2 — after patching compute_hash, pnpm wrappers also need node:
/mnt/c/Users/11635/AppData/Local/pnpm/.tools/pnpm/10.23.0/bin/pnpm: 15: exec: node: not found
A2UI bundling failed. Re-run with: pnpm canvas:a2ui:bundle
ELIFECYCLE Command failed with exit code 1.
# Confirm: bash invoked by pnpm IS WSL, not Git Bash:
$ uname -a # inside the bash subprocess pnpm spawns
Linux ... Microsoft ... WSL2Impact and severity
- Affected: All Windows developers who have WSL2 installed alongside Git Bash (a very common setup).
- Severity: High —
pnpm buildis completely blocked; the project cannot be built from source on Windows. - Frequency: 100% reproducible on any Windows machine where
bashin the system PATH resolves to WSL (the default when WSL2 is installed, sinceC:\Windows\System32comes before Git Bash in PATH). - Consequence: Windows developers cannot build or contribute to the project without a workaround.
Suggested fix
Two complementary changes to scripts/bundle-a2ui.sh:
1. Replace the Node.js-based compute_hash with a pure-bash sha256sum implementation (removes the node dependency from hash computation entirely; sha256sum is available natively in both WSL and Git Bash):
_sha256() {
if command -v sha256sum &>/dev/null; then
sha256sum "$@"
else
shasum -a 256 "$@" # macOS fallback
fi
}
compute_hash() {
(
for input_path in "${INPUT_PATHS[@]}"; do
if [[ -d "$input_path" ]]; then
while IFS= read -r -d '' f; do
printf '%s\0' "${f#"$ROOT_DIR/"}"
_sha256 < "$f" | cut -d' ' -f1
printf '\0'
done < <(find "$input_path" -type f -print0 2>/dev/null | sort -z)
elif [[ -f "$input_path" ]]; then
printf '%s\0' "${input_path#"$ROOT_DIR/"}"
_sha256 < "$input_path" | cut -d' ' -f1
printf '\0'
fi
done
) | _sha256 | cut -d' ' -f1
}2. Add WSL detection after the existing Docker fallback block, mirroring its pattern:
# WSL detection: pnpm on Windows resolves "bash" to WSL bash (System32/bash.exe),
# where native Node.js is typically absent and pnpm wrappers (tsc/rolldown) fail.
# Use the prebuilt bundle if available; otherwise guide the user to build outside WSL.
if grep -qi microsoft /proc/version 2>/dev/null; then
if [[ -f "$OUTPUT_FILE" ]]; then
echo "A2UI bundle up to date; skipping (WSL detected, using prebuilt bundle)."
exit 0
fi
echo "WSL environment detected but no prebuilt bundle found at: $OUTPUT_FILE" >&2
echo "Run outside WSL to build it: open Git Bash and run: pnpm canvas:a2ui:bundle" >&2
exit 1
fiDetection note: grep -qi microsoft /proc/version correctly identifies WSL1 and WSL2 while leaving Git Bash (MINGW64_NT) and native Linux untouched.
A PR with this fix can be provided if helpful.