Skip to content

fix: bun run dev:desktop fails on Windows — ChildProcess.spawn cannot resolve .cmd shims #474

@chuks-qua

Description

@chuks-qua

What

bun run dev:desktop fails on Windows with a PlatformError: NotFound when spawning bun tsdown. The build step in apps/server/scripts/cli.ts never completes, so the desktop app cannot start.

Error

PlatformError: NotFound: ChildProcess.spawn (bun tsdown)

Why

On Windows, bun is installed as bun.cmd (a shell wrapper). Node's child_process.spawn cannot resolve .cmd extensions without shell: true. The current code at cli.ts:131 calls ChildProcess.make without setting shell, so spawn looks for a literal bun executable and fails.

This happens when:

  • The user installs Bun from a different source than the default (e.g., via npm i -g bun, Scoop, or a standalone installer that creates .cmd shims)
  • There is no Turborepo cache hit for the tsdown build step (e.g., a fresh clone, cleared cache, or a git worktree)

When Turbo has a cached build, the bun tsdown spawn is skipped entirely, which masks the bug.

Fix

Add shell: true on Windows to ChildProcess.make at cli.ts:131:

yield* runCommand(
  ChildProcess.make({
    cwd: serverDir,
    stdout: config.verbose ? "inherit" : "ignore",
    stderr: "inherit",
    shell: process.platform === "win32",
  })`bun tsdown`,
);

The same pattern may apply to the npm call at cli.ts:224, since npm is also a .cmd shim on Windows.

Steps to Reproduce

  1. Install Bun on Windows (via npm, Scoop, or standalone installer)
  2. Clone the repo
  3. Run bun install
  4. Clear Turbo cache or use a fresh worktree (so no cached build exists)
  5. Run bun run dev:desktop
  6. Observe the PlatformError: NotFound crash

Environment

  • Windows 11 Pro (10.0.22631)
  • Bun 1.x (installed via standalone installer, creates .cmd shims)
  • Node.js (.cmd shim behavior is standard on Windows)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions