What this thread does
The problem
Match Bun errors to the diagnostic path below.
Versions and status — checked 2026-11-20
Not for: Node, Bun or Deno runtime selection or OpenCode binary crashes.
| Component | Verified status | Official source |
|---|---|---|
| Bun runtime and package manager | As of November 2026, 1.4.5 is Latest on GitHub; release published 2026-11-19 | Release, release post |
| Licence | Bun itself MIT; linked JavaScriptCore/WebKit LGPL-2 and other dependencies have their own terms | Tagged licence |
Sources below were fetched and checked 2026-10-20. Historical reports verify demand/spelling, not persistence in the latest release.
Choose the diagnostic path
| Where it fails | First move |
|---|---|
| Frozen install | Check runtime alignment and manifest/lockfile drift |
| DOM test | Confirm the preload runs before component imports |
| Server listen | Separate occupied port from address/permission failure |
| Script cannot spawn Node | Check the executable visible in the same shell |
1. Frozen lockfile
Exact message error: lockfile had changes, but lockfile is frozen.
Usually manifests disagree with the lockfile. --production implies frozen behavior. Resolver/update bugs have also produced this message.
At the workspace root, align Bun with CI, reconcile intentional changes locally and inspect the diff:
bun --version
bun install
git diff -- package.json bun.lock
bun install --frozen-lockfile
Save intended manifests/lockfile together. Diagnose without installing with bun install --frozen-lockfile --dry-run. If fresh output still fails on identical inputs/runtime, retain the reproduction; no universal repair is verified.
Do not delete lockfiles or remove CI's frozen check. Current docs support pruned workspaces under stated conditions; old blanket failure claims are stale.
Official install contract, checked 2026-10-20. Community evidence from zlotnika's update/lockfile report #31748, opened 2026-06-03, checked 2026-10-20, describes an update leaving stale snapshots and reports that running install afterward reconciles them. nicksrandall's independent report #20913, opened 2025-07-09, checked 2026-10-20, shows the same string even after an unchanged install. These are different failure paths, not one proven cause.
2. DOM globals missing in bun test
Exact message ReferenceError: document is not defined.
Bun tests need DOM globals registered before component imports. Types alone do not create a runtime document.
The documented setup is:
bun add -d @happy-dom/global-registrator
Create happydom.ts with this code:
import { GlobalRegistrator } from "@happy-dom/global-registrator";
GlobalRegistrator.register();
Then run from the directory containing that file:
bun test --preload ./happydom.ts
Persist it in bunfig.toml under [test] with preload = ["./happydom.ts"]. Test one file and the suite. Suite-only failures also need cleanup/unregister and shared-global investigation.
Do not add document = {} stubs, suppress the assertion or expect a TypeScript DOM reference to initialize globals.
Official DOM setup and preload/test execution, checked 2026-10-20. BrunoQuaresma's upstream report #21358, opened 2025-07-24, checked 2026-10-20, quotes this exact message while individual tests pass and the combined suite fails. A missing preload is not established as that report's cause.
3. Bun.serve bind failure
Exact message error: Failed to start server. Is port 80 in use?, with code EADDRINUSE, appears in the linked report.
Usually another listener owns the address/port. However, chefnaphtha's upstream report #30363, opened 2026-05-07, checked 2026-10-20, demonstrates a privileged-port permission failure on macOS being labelled as port contention. Do not infer occupancy from the message alone.
Inspect the listener without killing it:
lsof -nP -iTCP:80 -sTCP:LISTEN
For local development, explicitly bind a high loopback port in a minimal probe:
bun -e 'Bun.serve({hostname:"127.0.0.1",port:8080,fetch(){return new Response("ok")}})'
Stop the probe with Ctrl-C. If it works, check the original port, privileges and interface. In tests use port: 0, read server.port and clean up with await server.stop(). Production needs a deliberate port/proxy configuration.
Do not kill arbitrary PIDs, run the whole app as root, or use reusePort as a generic repair. Do not claim the historical errno-reporting bug is fixed without reproducing it on your installed version.
Official port, hostname and lifecycle options, checked 2026-10-20. The probe is a diagnostic, not an upstream patch.
4. Node executable missing during install or bunx
Exact message bun: command not found: node.
Scripts and CLIs can explicitly launch Node even when Bun installs them. The bunx docs, checked 2026-10-20, explain that a Node shebang starts Node by default.
Check both executables in the same terminal that fails:
bun --version
node --version
If Node is unavailable, install it for the platform using the official Node download instructions, checked 2026-10-20, reopen the terminal, and verify node --version succeeds before rerunning bun install. If Node works but the script fails, retain its command/PATH context; no universal Windows fix is established.
For a CLI you have separately verified supports Bun, the documented alternative is bunx --bun my-cli (replace the placeholder with the actual executable). The flag must precede the executable. This is for CLI execution, not a blanket conversion of arbitrary install lifecycle scripts.
Do not assume bun install -g node can bootstrap a script that already requires Node; do not use --trust to repair PATH. Check the Node-compatibility matrix, checked 2026-10-20, before forcing an otherwise Node-targeted program onto Bun.
Community evidence from zenerbufen's Windows install report #44033, opened 2026-09-26, checked 2026-10-20, contains the exact string in both a package postinstall and an attempted Node preinstall. Inconsistent success is reported; no maintainer-confirmed diagnosis is given.
A prompt to give your agent
Read the linked official source and upstream issue; do not guess messages or assume a fix shipped. Capture version, OS, working directory and exact command/error. Choose lockfile, DOM, bind or Node diagnosis. Test the smallest change and complete suite in a disposable copy; show diffs. Keep CI frozen; do not trust scripts, kill processes or replace production automatically.
Limits
No installs, tests, server probes or upgrades were run here. These are four verified diagnostic families, not a measured top-four ranking for 2026. DOM community evidence is older; the other cited reports include 2026 demand. Not every report has a human maintainer answer; automation/triage is not confirmation. Exact generic strings postinstall script blocked, Bun.serve EADDRINUSE, and Cannot find package X were not verified as literal current Bun output and are not repair targets here. Current support and exact output for the historical node:stream/iter incompatibility were not established. Missing Node does not exhaust Node API incompatibilities.
Started from a post by @zenerbufen, packaged by the editor. Original post