From 6c42eaaae298625c72458b78c9516a6f383968f6 Mon Sep 17 00:00:00 2001 From: Bin Deng Date: Wed, 4 Mar 2026 01:36:57 +0800 Subject: [PATCH 1/2] fix(build): add WSL detection to bundle-a2ui.sh --- scripts/bundle-a2ui.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/bundle-a2ui.sh b/scripts/bundle-a2ui.sh index 3278e1d35a3..835c9a47ee7 100755 --- a/scripts/bundle-a2ui.sh +++ b/scripts/bundle-a2ui.sh @@ -24,6 +24,21 @@ if [[ ! -d "$A2UI_RENDERER_DIR" || ! -d "$A2UI_APP_DIR" ]]; then exit 1 fi +# WSL detection: when pnpm runs "bash" on Windows it resolves to WSL +# (C:\Windows\System32\bash.exe), where native Node.js is typically absent. +# The pnpm wrappers for tsc/rolldown also invoke node internally, so the +# entire build pipeline fails. Use the prebuilt bundle when available; +# otherwise guide the user to build outside WSL where Windows node is on PATH. +if grep -qi microsoft /proc/version 2>/dev/null; then + if [[ -f "$OUTPUT_FILE" ]]; then + echo "WSL detected; using prebuilt A2UI bundle." + exit 0 + fi + echo "WSL environment detected but no prebuilt bundle found at: $OUTPUT_FILE" >&2 + echo "Build outside WSL first (e.g. Git Bash): pnpm canvas:a2ui:bundle" >&2 + exit 1 +fi + INPUT_PATHS=( "$ROOT_DIR/package.json" "$ROOT_DIR/pnpm-lock.yaml" From f54b881fef9daf7a78335c0a903a9b5623ccc075 Mon Sep 17 00:00:00 2001 From: Bin Deng Date: Wed, 4 Mar 2026 01:46:55 +0800 Subject: [PATCH 2/2] fix(build): narrow WSL guard to trigger only when Node.js is absent --- scripts/bundle-a2ui.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/bundle-a2ui.sh b/scripts/bundle-a2ui.sh index 835c9a47ee7..f3827da9634 100755 --- a/scripts/bundle-a2ui.sh +++ b/scripts/bundle-a2ui.sh @@ -27,15 +27,15 @@ fi # WSL detection: when pnpm runs "bash" on Windows it resolves to WSL # (C:\Windows\System32\bash.exe), where native Node.js is typically absent. # The pnpm wrappers for tsc/rolldown also invoke node internally, so the -# entire build pipeline fails. Use the prebuilt bundle when available; -# otherwise guide the user to build outside WSL where Windows node is on PATH. -if grep -qi microsoft /proc/version 2>/dev/null; then +# entire build pipeline fails. Only activate the guard when Node.js is +# missing — WSL-primary developers with node installed can build normally. +if grep -qi microsoft /proc/version 2>/dev/null && ! command -v node >/dev/null 2>&1; then if [[ -f "$OUTPUT_FILE" ]]; then - echo "WSL detected; using prebuilt A2UI bundle." + echo "WSL detected (no Node.js available); using prebuilt A2UI bundle." exit 0 fi - echo "WSL environment detected but no prebuilt bundle found at: $OUTPUT_FILE" >&2 - echo "Build outside WSL first (e.g. Git Bash): pnpm canvas:a2ui:bundle" >&2 + echo "WSL environment detected but Node.js is not installed and no prebuilt bundle found." >&2 + echo "Either install Node.js inside WSL, or build outside WSL (e.g. Git Bash): pnpm canvas:a2ui:bundle" >&2 exit 1 fi