ReferenceCLI and configuration
CLI and configuration
Common Bun commands, configuration files, environment inputs, and diagnostic order
Last updated on
Command map
| Goal | Command |
|---|---|
| Version / revision | bun --version / bun --revision |
| Execute a file | bun run index.ts |
| Execute a package script | bun run dev |
| Restart on change | bun --watch index.ts |
| Initialize a project | bun init |
| Install dependencies | bun install |
| Frozen install | bun install --frozen-lockfile |
| Add / remove | bun add <pkg> / bun remove <pkg> |
| Execute package CLI | bunx <pkg> |
| Test | bun test |
| Bundle | bun build <entry> |
Configuration ownership
| File | Owns | Required? |
|---|---|---|
package.json | Scripts, dependencies, workspaces, module metadata | Yes |
bun.lock | Exact dependency graph | Commit for dependency-based projects |
bunfig.toml | Bun-specific install, runtime, and test settings | No |
tsconfig.json | TypeScript resolution, aliases, and checking | Usually for TS |
.env* | Local environment values | Optional; do not commit secrets |
Minimal bunfig.toml
[run]
silent = false
[test]
coverage = false
[install.lockfile]
save = trueOnly add keys you have verified against the current official docs and actually need.
Diagnostic order
- Record
bun --versionandbun --revision. - Confirm the working directory and selected
package.json. - Inspect
bun.lock,bunfig.toml, and environment variables. - Reduce the issue to separate framework, dependency, and runtime behavior.
- Consult current docs and issues before choosing an upgrade or workaround.
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.