CLI and configuration

Common Bun commands, configuration files, environment inputs, and diagnostic order

Last updated on

Command map

GoalCommand
Version / revisionbun --version / bun --revision
Execute a filebun run index.ts
Execute a package scriptbun run dev
Restart on changebun --watch index.ts
Initialize a projectbun init
Install dependenciesbun install
Frozen installbun install --frozen-lockfile
Add / removebun add <pkg> / bun remove <pkg>
Execute package CLIbunx <pkg>
Testbun test
Bundlebun build <entry>

Configuration ownership

FileOwnsRequired?
package.jsonScripts, dependencies, workspaces, module metadataYes
bun.lockExact dependency graphCommit for dependency-based projects
bunfig.tomlBun-specific install, runtime, and test settingsNo
tsconfig.jsonTypeScript resolution, aliases, and checkingUsually for TS
.env*Local environment valuesOptional; do not commit secrets

Minimal bunfig.toml

[run]
silent = false

[test]
coverage = false

[install.lockfile]
save = true

Only add keys you have verified against the current official docs and actually need.

Diagnostic order

  1. Record bun --version and bun --revision.
  2. Confirm the working directory and selected package.json.
  3. Inspect bun.lock, bunfig.toml, and environment variables.
  4. Reduce the issue to separate framework, dependency, and runtime behavior.
  5. Consult current docs and issues before choosing an upgrade or workaround.
Agent report template
Environment: Bun <version>, <os>/<arch>
Command: <exact command>
Expected: <observable result>
Actual: <exit code + concise error>
Minimal reproduction: <path or snippet>
Verification: <tests actually run>

Official references: Bun Runtime CLI and bunfig.toml.