ReferenceCommon errors

Common errors

Causes and fixes for frequent Bun error messages, grouped by the stage where they occur

Last updated on

Install and startup

ErrorLikely causeFix
bun: command not found~/.bun/bin is not on PATHReopen the terminal; the installer's PATH hint only applies after the shell config reloads
unzip is required to install Bununzip missing on Linuxsudo apt install unzip (or your distro's equivalent), then rerun the installer
Compatibility error right after installing on WindowsOS older than Windows 10 1809Upgrade Windows; there is no workaround

Dependencies and lockfiles

ErrorLikely causeFix
lockfile had changes, but lockfile is frozenpackage.json and bun.lock are out of syncRun bun install locally, review the diff, commit bun.lock together with the manifest
bun audit reports a missing lockfileNo bun.lock in the repoRun bun install first; audit reads the lockfile
bun audit --production fails as an unknown flagThat spelling is unsupportedUse bun audit --prod; filtering at monorepo roots has a known defect
Blocked postinstall in install logsDependency is not in the trust listInspect with bun pm untrusted; after review, grant minimally with bun pm trust <pkg>
Cannot find package inside a workspacePackage added/moved without reinstallingRun bun install at the repo root; confirm workspaces covers the directory
--frozen-lockfile fails right after bun updateLockfile write defectRun bun install once more locally and commit (see known issues)

Runtime

ErrorLikely causeFix
EADDRINUSE / port already in useA stale process or port conflictPick a different PORT or stop the old process; check for stray --watch processes
error: Script not found "xxx"Wrong working directory or a typoConfirm the package.json in the current directory; bare bun run lists available scripts
Stale or unexpected environment variablesBun auto-loaded a local .envUse --no-env-file in production so only platform-injected variables apply
Bun.serve streaming responses cut off after ~10sDefault idleTimeout is 10 secondsRaise idleTimeout after evaluation, or call server.timeout(req, 0) per request — keep an application-level total timeout

Types and tests

ErrorLikely causeFix
Cannot find module 'bun:test' or missing Bun global typesBun types not installed/declaredbun add -d @types/bun; since TypeScript 6 also set "types": ["bun"] in tsconfig.json
--isolate fails on dynamic import of top-level-await modulesKnown regression in 1.3.14Run affected suites serially; track known issues
Tests interfere with each other under --parallelShared ports, databases, or temp directoriesAllocate per-worker resources via BUN_TEST_WORKER_ID, or keep that group serial

Troubleshooting order

  1. Run bun --version, then rule out "version too old" against the version matrix.
  2. Confirm the working directory and the package.json / bunfig.toml actually in effect.
  3. Build a minimal reproduction to separate project configuration from Bun runtime behavior.
  4. Check known issues and oven-sh/bun issues before upgrading or working around.