Skip to content

fix(dev): spawn the running Bun so npm-installed Bun works on Windows - #4525

Draft
oseunabel62-tech wants to merge 4 commits into
debpalash:mainfrom
oseunabel62-tech:fix/windows-npm-bun-spawn
Draft

oseunabel62-tech wants to merge 4 commits into
debpalash:mainfrom
oseunabel62-tech:fix/windows-npm-bun-spawn

Conversation

@oseunabel62-tech

Copy link
Copy Markdown

Problem

On Windows with Bun installed through npm (npm i -g bun), bun run dev fails before the app starts:

$ node scripts/prepare-dev.mjs
[dev] spawnSync bun ENOENT
error: script "predev" exited with code 1

spawn runs no shell, so a bare "bun" only resolves bun.exe. npm puts only bun.cmd / bun.ps1 shims on PATH.

Fix

  • New electron/scripts/bun-command.mjs → bunCommand(): the Bun running the script (process.execPath under Bun), else the Bun binary bun run exports as npm_execpath, else "bun".
  • Used for every Bun spawn in the scripts: scripts/prepare-dev.mjs, scripts/electron-smoke-test.mjs, scripts/perf/renderer-baseline.mjs (bunx → bun x).
  • A Bun that is truly missing now gives an install hint instead of a raw ENOENT.
  • Recurrence guard: a test fails if any file in scripts/ or electron/scripts/ spawns a bare bun/bunx.

macOS/Linux behavior is unchanged (npm_execpath is the same Bun that a bare bun resolves to there).

Tests

  • tests/frontend/bunCommand.test.mjs: 6 tests. 3 fail before the fix and pass after.
  • node --test tests/frontend/bunCommand.test.mjs tests/frontend/setupApi.test.mjs electron/tests/node-version.test.mjs: 39 pass, 0 fail.
  • Manual check on Windows 11 with npm-installed Bun 1.4.2: bun run predev fails before the fix and passes after.

`spawn` runs no shell, so a bare "bun" only resolves bun.exe. An
npm-installed Bun puts only bun.cmd/bun.ps1 shims on Windows PATH, and
`bun run dev` failed in predev with "spawnSync bun ENOENT".

Resolve the executable through a shared bunCommand() helper: the Bun
running the script, else the bun binary `bun run` exports as
npm_execpath, else "bun". Use it for every Bun spawn in scripts
(prepare-dev, electron smoke test, renderer perf baseline), explain a
missing Bun instead of a raw ENOENT, and fail CI on any new bare
bun/bunx spawn.
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for contributing to VoiceStudio. Before this pull request can merge, everyone who contributed to it must sign the Contributor License Agreement 1.0 once. You keep your copyright; the agreement lets Yupcha Softwares Private Limited, the company that maintains VoiceStudio, ship your work in both the AGPL-3.0 app and commercial builds.

Still to sign: @oseunabel62-tech, @oluwaseun244311

To sign, post this as a new comment on its own line:

I have read the VoiceStudio CLA 1.0 and I hereby sign it.

Comment recheck to run the check again.

CI and automated reviews wait for your signature. Signing takes a minute; once you sign, CI starts automatically and this pull request is marked ready for review. Until then it stays a draft.

Using an AI coding agent? Give it this
Before changing anything, read https://github.com/debpalash/VoiceStudio/blob/main/.github/AGENT_PR_GUIDE.md and follow every step in it. Finish every step before you ask for review.

@github-actions
github-actions Bot marked this pull request as draft November 28, 2026 21:42
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

CLA deadline: 2026-12-02 UTC (2 days remaining). Signing takes a minute: follow the instructions in the CLA check above. After the deadline, maintainers may independently fix the underlying issue without using your contribution. You can still sign after the deadline; this timer does not close your pull request.

@github-actions github-actions Bot added the awaiting-cla Contributor CLA signature required before merge label Nov 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@oseunabel62-tech, @oluwaseun244311 — a reminder that the CLA deadline is 2026-12-02 UTC. Please see the CLA instructions above.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-cla Contributor CLA signature required before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants