PostHog / PostHog/posthog

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

Open
#76,200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature/desktop
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/code/scripts/postinstall.sh and scripts/ensure-phrocs.sh, then inspect the dev scripts and mprocs.yaml. Reproduce pnpm install and pnpm dev on stock Windows 11, using the reported WSL bash failure and phrocs rejection as checkpoints. Done means Windows setup no longer requires a bash workaround or hard-fails without phrocs, and the documented fallback is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript, node.js, shell
Domain
build-system, developer-experience, documentation, operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
61/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.