A single native binary that runs TypeScript and JavaScript directly, bundles projects, installs npm packages, and executes test suites. This page covers requirements, configuration paths, CLI flags, and known Windows-specific fixes for developers and CI administrators.
Overview | Requirements | Key Features | Configuration | Backend Comparison | Keyboard Shortcuts | Command-Line Options | Troubleshooting | FAQ | Notes
Bun Runtime consolidates the toolchain a modern JavaScript project normally spreads across Node.js, npm, ts-node, esbuild, and Jest into one executable. The sections below document behavior on Windows 10 and 11 only.
Executes .ts, .tsx, .js, and .jsx entrypoints without a transpile step, resolves package.json dependencies with its own installer, and produces single-file bundles through bun build. All four operations share one runtime and one lockfile.
Backend developers, frontend build engineers, and CI administrators who want deterministic dependency resolution and faster cold starts on Windows runners. It suits teams migrating from a Node.js plus npm plus separate bundler setup.
The installer places bun.exe plus a versioned runtime folder under %LOCALAPPDATA%, registers the PATH entry, and optionally installs the bunx shim. No separate Node.js install is required for runtime execution.
| Spec | Minimum | Recommended |
|---|---|---|
| OS | Windows 10 version 1809 (build 17763) | Windows 11 22H2 or later |
| CPU | x86-64 with SSE4.2 | x86-64-v2, 4 cores or better |
| RAM | 2 GB | 8 GB |
| Display | Console host, any resolution | Windows Terminal with UTF-8 codepage |
| Storage | 350 MB free | 2 GB free for package cache and bundles |
| Runtime target | Node.js compatibility layer, ESM and CJS | Node 20 API surface for native module builds |
- Direct TypeScript execution, runs
.tsand.tsxfiles through the native transpiler with notscstep. - Built-in package installer, resolves and links npm dependencies from
bun.lockbin one pass. - Bundler and minifier, emits single-file ESM or CJS output via
bun build --target. - Test runner, discovers
*.test.tsfiles and reports TAP or JUnit output. - Node API compatibility, implements
fs,path,http,crypto, andBuffersubsets. - Workspace support, reads
workspacesfrompackage.jsonand hoists linked packages. - Single binary updater, upgrades the runtime in place with
bun upgrade. - Windows-native process spawning, handles
cmd.exeand PowerShell invocation without a POSIX shim.
| Path | Purpose |
|---|---|
%USERPROFILE%\.bun\bunfig.toml |
Per-user global config: registry, install behavior, test defaults |
%USERPROFILE%\.bun\install\cache |
Downloaded package tarballs and extracted module cache |
%LOCALAPPDATA%\Bun\bin |
Installed bun.exe and versioned runtime folders |
%LOCALAPPDATA%\Bun\logs |
Runtime logs, crash dumps, and install transcripts |
%APPDATA%\Bun\telemetry.json |
Opt-in telemetry state and endpoint override |
%PROGRAMDATA%\Bun\policy.toml |
Machine-wide admin policy for registry and update channel |
| Setting | Default | Notes |
|---|---|---|
install.registry |
https://registry.npmjs.org |
Override for private or mirrored npm registries |
install.frozenLockfile |
false |
Set true in CI to fail on lockfile drift |
run.smol |
false |
Reduces memory footprint at the cost of throughput |
test.preload |
empty | Comma-separated modules loaded before each test file |
telemetry.enabled |
false |
Opt-in; toggled via bun pm telemetry disable |
update.channel |
stable |
Accepts stable, canary, or pinned |
log.level |
info |
One of trace, debug, info, warn, error |
| Runtime | Install time (empty cache) | Cold start (hello.ts) |
Package manager | Best for |
|---|---|---|---|---|
| Bun 1.x native | 4 s | 28 ms | Built-in (bun install) |
New projects, CI speed |
| Node.js 20 + npm | 9 s | 62 ms | npm | Maximum ecosystem breadth |
| Node.js 20 + pnpm | 6 s | 60 ms | pnpm | Monorepos with strict hoisting |
| Deno 1.x | 7 s | 45 ms | Built-in (URL imports) | Permission-sandboxed scripts |
Timings measured on a 4-core Windows 11 VM with a 10-package fixture manifest; treat as directional, not a benchmark guarantee.
| Action | Shortcut |
|---|---|
| Interrupt running script or test suite | Ctrl+C |
| Clear console and reset scrollback | Ctrl+L |
| Verbose runtime trace during a run | Ctrl+Shift+D toggle in bun repl |
Paste multiline snippet into bun repl |
Shift+Insert |
| Open the logs folder in Explorer | Ctrl+Shift+O in the tray menu |
| Copy last error block to clipboard | Ctrl+Shift+C in bun repl |
| Suspend foreground process (Windows) | Ctrl+Z (mapped to SIGTSTP stub) |
| Force exit on hung child process | Ctrl+Break |
Autocomplete suggestion in bun repl |
Tab |
| Toggle tray window visibility | Ctrl+Alt+B |
| Flag | Argument | Purpose |
|---|---|---|
--watch |
none | Re-runs the entrypoint when imported files change |
--hot |
none | Enables hot module reload for bun run --hot |
--target |
browser, bun, node |
Selects bundle output platform |
--outdir |
path | Writes build artifacts to the given directory |
--frozen-lockfile |
none | Aborts install if bun.lockb needs regeneration |
--production |
none | Skips devDependencies during install |
--preload |
module list | Loads modules before the entrypoint executes |
--smol |
none | Lowers heap target for constrained CI containers |
bun run --watch --preload ./src/setup.ts ./src/server.ts
| Exit Code | Meaning |
|---|---|
0 |
Success |
1 |
Uncaught exception or failed assertion |
2 |
Invalid CLI flag or missing argument |
3 |
Test suite completed with failing cases |
10 |
Install failed resolving a registry dependency |
Occurs when the project folder sits in a OneDrive-synced directory where file handles are held by the sync client.
- Pause OneDrive sync for the project folder.
- Move the repository to a local path such as
C:\src\project. - Confirm
bun.lockbis not marked read-only viaattrib. - Re-run
bun installfrom an elevated terminal if the folder ACL is inherited from a protected root.
The PATH entry was added but the parent shell predates the change.
- Close all terminal, IDE, and explorer windows.
- Sign out and back in, or run
refreshenvif Chocolatey is present. - Verify
%LOCALAPPDATA%\Bun\binappears inecho %PATH%. - Run
where bunto confirm the shim resolves.
tsconfig.json paths are honored by tsc but not automatically by the runtime loader.
- Add
compilerOptions.pathsaliases tobunfig.tomlunder[run]tsconfigOverride. - Alternatively declare aliases in
package.jsonimportswith the#prefix. - Restart any
--watchsession so the config cache reloads. - Verify with
bun ./src/entry.tsbefore building.
Node-gyp shims cannot locate the Visual Studio build tools after an upgrade.
- Open "x64 Native Tools Command Prompt for VS" and run
bun rebuild. - Confirm Visual Studio Build Tools with the C++ workload and Windows SDK are installed.
- Set
npm_config_msvs_versionto the installed toolset year. - Delete
%LOCALAPPDATA%\Bun\install\cacheand reinstall dependencies.
No. Bun writes its own binary bun.lockb. Projects kept in mixed-tooling teams typically commit both bun.lockb and package-lock.json, and CI jobs pick the lockfile matching the invoking tool.
Yes. The module loader resolves main and exports fields with a CJS fallback and interop shim. Packages that mutate module.exports after async boundaries may need --preload to stabilize initialization order.
bun upgrade fetches the latest build on the configured update.channel. Administrators pin a version by setting update.channel = "pinned" in %PROGRAMDATA%\Bun\policy.toml and distributing the runtime via an internal package feed.
Bun is a project of Oven, Inc. Windows is a trademark of Microsoft Corporation. Node.js is a trademark of the OpenJS Foundation. Registry, CLI, and path behavior described here reflects the current stable Windows build.
