---
title: "Recipe: ports, Bun and Chrome"
description: "The port that web, test web and agent web serve on, the Bun and Chrome the launchers use, and the stores a drive keeps or resets."
modificationDate: "2026-11-01"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: ports, Bun and Chrome

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/recipes/ports-and-browsers: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

**Ports.** `--port <n>` on `web`, `test web` and `agent web`, or `EXACT_PORT=<n>`,
serves on that port; a held port is refused. Otherwise each picks a free port within `PORT_LO`–`PORT_HI` when both are set, and
prints its URL. A native client starts a second loop on `n+1`. A storage store
keeps its data per port, so drive one store on one port.

```prompt Fix a port that is taken
Make the Exact app in this folder serve, test and drive on the web when a port is taken, or when Bun or Chrome is not found. Use https://github.com/expo/exact/blob/main/docs/recipes/ports-and-browsers.md as the source for each step. The Exact checkout has the same page at docs/recipes/ports-and-browsers.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say which command failed and what it printed, ask me, or run it and read its message. If I want a fixed port, ask me for its number.
3. A held port is refused. A second web loop of the same target for this app refuses and names the first loop's URL and PID: use that URL, or ask me before you stop that loop. Do not stop a process that you did not start.
4. To choose the port, add `--port <n>` to `web`, `test web` or `agent web`, or set `EXACT_PORT=<n>`. With neither, each command picks a free port (within `PORT_LO` to `PORT_HI` when both are set) and prints its URL: read that URL, and do not assume a port. A native client starts a second loop on `n+1`: keep that port free too.
5. A storage store keeps its data per port: drive one store on one port. `agent web --storage s1` starts empty each run. Add `--keep-storage` to reopen its saved data, or `--reset-storage` to reset it. A live drive owns its profile: another drive cannot reset it.
6. If Bun is not found: launchers prefer `$BUN`, then `~/.bun-1.4.2/bin/bun`, and `./exact.mjs` also works when PATH has no Bun. To select a Chromium, set `CHROME=/absolute/path/to/chrome`. Set a variable for the command only, and ask me before you change my shell profile.
7. Rerun the command that failed. For `web`, check that it serves at the printed URL. For `test web` or `agent web`, check the command's result. Report any failure that predates your changes or persists after three rounds of fixes, and record it as in step 8.
8. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
9. Tell me what held the port, the port and the URL the app uses now, and the command to run. Tell me what I must still do, if anything: stop another process, or set `BUN` or `CHROME` in my shell profile.
```

- **Bun and Chrome.** Launchers prefer `$BUN`, then `~/.bun-1.4.2/bin/bun`,
  independently of a login shell’s PATH. Generated commands and child scripts
  inherit that binary. `./exact.mjs` also works when PATH has no Bun. Set `CHROME=/absolute/path/to/chrome` to select Chromium.
- **Named Chrome stores.** `agent web --storage s1` starts empty each run.
  Add `--keep-storage` to reopen its saved data and password session, or
  `--reset-storage` to explicitly reset it. A live drive owns its profile;
  another drive cannot reset it. Authored tests always isolate their browser
  stores, including across repeated suite runs. Backend rows persist: use
  `fresh` with `dev`, or create uniquely keyed fixtures with `serve`.
  Firefox/WebKit use a new profile each drive and do not preserve named stores.
- **Native stores.** `agent ios --storage s1` (macOS, Linux, Android alike) is kept
  between drives; `--reset-storage` empties it. One drive holds a store at a time.
  An iOS, macOS or Linux drive that names no store uses `default`, kept the same way.
