Windows Notes
Bun.WebView has a known issue spawning its own Chrome subprocess on Windows. Bunwright works around this automatically — no configuration needed.
What happens
Section titled “What happens”On Windows with the chrome backend, Bunwright:
- Finds a free port on
localhost - Launches Chrome with
--remote-debugging-port=<port> - Polls
http://127.0.0.1:<port>/json/versionfor thewebSocketDebuggerUrl - Passes that WebSocket URL as the
Bun.WebViewbackend
In this mode, backend.path and backend.argv from your config are ignored — the workaround manages the Chrome process itself.
Chrome executable resolution
Section titled “Chrome executable resolution”Bunwright finds Chrome in this order:
BUN_CHROME_PATHenvironment variableconfig.backend.pathin yourbunwright.config.ts- Common Windows install locations:
C:\Program Files\Google\Chrome\Application\chrome.exeC:\Program Files (x86)\Google\Chrome\Application\chrome.exe%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe
If none are found, an error is thrown.
Headless mode
Section titled “Headless mode”By default, Bunwright runs Chrome headless (--headless=new) on Windows and headed elsewhere. Override with config:
import { defineConfig } from "bunwright";
export default defineConfig({ headless: false, // show the browser window on Windows});Cleanup
Section titled “Cleanup”The spawned Chrome process is:
- Killed on
browser.close() - Killed on process exit (via
beforeExit/exithandlers)
You don’t need to manage it manually.
Debugging
Section titled “Debugging”Set BUNWRIGHT_DEBUG=1 to log the spawned Chrome port:
set BUNWRIGHT_DEBUG=1bunx bunwright my-script.ts# [bunwright] Spawned Chrome on port 9222 (Windows workaround)WebKit on Windows
Section titled “WebKit on Windows”If you use backend: "webkit", the Windows workaround does not apply — Bun.WebView handles WebKit directly. The workaround is specific to the Chrome backend.