Skip to content

Windows dev setup fails: postinstall requires bash, ensure-phrocs rejects Windows #3252

Description

@trippyogi

Fresh clone on Windows 11 fails twice before reaching a dev environment.
With workarounds, everything else works: full build (7/7), signed
win-unpacked app, app runs. The toolchain already targets Windows
(win32 map in download-binaries.mjs, conpty signing, codex.exe/rg.exe
fetch fine), so these look like gaps, not an unsupported platform.

Env: Windows 11 (26200), Node 22.12.0, pnpm 10.23.0, Git for Windows,
WSL launcher present but no distro.

1. pnpm install: postinstall hard-requires bash. apps/code runs
bash scripts/postinstall.sh; on stock Windows, bash is the System32
WSL stub:
<3>WSL (9 - Relay) ERROR: execvpe(/bin/bash) failed: No such file or directory

Workaround: point bash at Git Bash (PATH or pnpm script-shell). The
script is Windows-safe once a real bash runs it. Suggested fix: convert
to a Node script with the plist step gated on darwin. Four of five steps
are already Node calls. Happy to PR this.

2. pnpm dev: ensure-phrocs.sh whitelists darwin|linux and exits
(Unsupported OS: mingw64_nt-10.0-26200). No Windows phrocs binary is
published, and the dev:mprocs fallback assumes mprocs is installed.
Workaround: run pnpm dev:agent and pnpm dev:code in two terminals.
Suggested fix: publish a windows binary, or have pnpm dev print the
two-terminal fallback instead of hard-exiting. Can PR the script side.

3. Docs have no Windows section; a few lines covering both points
above would prevent this issue. Can fold into the postinstall PR.

(Cosmetic: fresh installs warn Failed to create bin ... agent-server ...bin.cjs.EXE until the workspace package first builds.)

Failure 1: pnpm install postinstall (WSL bash stub)
Scope: all 21 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +2550
Progress: resolved 0, reused 2329, downloaded 17, added 2550, done
node_modules/@parcel/watcher: Running install script, done in 123ms
node_modules/node-pty: Running install script, done in 143ms
node_modules/esbuild: Running postinstall script, done in 268ms
node_modules/better-sqlite3: Running install script, done in 705ms
[additional install scripts trimmed]
 WARN  Failed to create bin at C:\dev\code\packages\api-client\node_modules\.bin\agent-server. ENOENT: no such file or directory, stat 'C:\dev\code\packages\api-client\node_modules\@posthog\agent\dist\server\bin.cjs.EXE'
 WARN  3 other warnings

╭ Warning ──────────────────────────────────────────────────────────────────╮
│   Ignored build scripts: @google/genai, koffi.                            │
│   Run "pnpm approve-builds" to pick which dependencies should be allowed  │
╰───────────────────────────────────────────────────────────────────────────╯

. preinstall$ node scripts/enforce-pnpm.mjs
└─ Done in 101ms
. prepare$ husky
└─ Done in 189ms
apps/code postinstall$ bash scripts/postinstall.sh
│ <3>WSL (9 - Relay) ERROR: CreateProcessCommon:640: execvpe(/bin/bash) failed: No such file or directory
└─ Failed in 4.8s at C:\dev\code\apps\code
 ELIFECYCLE  Command failed with exit code 1.
Failure 2: pnpm dev (ensure-phrocs rejects Windows)
> posthog-code@0.0.0 dev C:\dev\code
> pnpm build:deps && bash scripts/ensure-phrocs.sh && bin/phrocs --config mprocs.yaml

[full turbo build output trimmed: all packages built, electron-builder
packaged and signed out\win-unpacked\PostHog Code.exe successfully]

 Tasks:    7 successful, 7 total
Cached:    0 cached, 7 total
  Time:    3m5.536s

phrocs not found, downloading...
Unsupported OS: mingw64_nt-10.0-26200
 ELIFECYCLE  Command failed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions