Bun

Bun v1.1.3


Jarred Sumner · April 8, 2024

Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager — all in one.

Bun v1.1.3 fixes 5 bugs. bun install gets 50% faster on Windows. A bug that could cause bun install to hang in rare cases has been fixed. A bug where some errors in bun install would not produce a non-zero exit code has been fixed. A bug that could cause specific certain combinations of dependencies to fail to install has been fixed. A bug on Windows where CTRL + C on cmd.exe after exiting bun would not behave as expected has been fixed. A bug where missing permissions on Windows for reading a directory could lead to a crash has been fixed.

Previous releases

  • v1.1.2 Bun v1.1.2 fixes 4 bugs (addressing 44 👍 reactions). EBUSY on Windows in vite dev, next dev, and saving bun.lockb has been fixed. Bun Shell gets support for seq, yes, basename and dirname. A TypeScript parsing edgecase has been fixed. A bug causing 'unreachable code' errors has been fixed. fs.watch on Windows has been rewritten to improve performance and reliability.
  • v1.1.1 Bun v1.1.1 fixes 20 bugs (addressing 60 👍 reactions). Add subshell and positional argument support. Printed source code in errors no longer fill up your terminal. Upgrades JavaScriptCore, which includes performance improvements to RegExp, typed arrays, String indexOf and String replace. Error objects and JIT'd function calls use less memory. Fixes several bugs with bun install on Windows. Fixes a bug with Bun.serve() on Windows. Fixes a TOML parser bug impacting escape sequences and windows paths in .toml files.
  • v1.1.0 Bundows. Windows support is here! Plus, JSON IPC Node <-> Bun.

To install Bun:

curl
npm
powershell
scoop
brew
docker
curl
curl -fsSL https://bun.sh/install | bash
npm
npm install -g bun
powershell
powershell -c "irm bun.sh/install.ps1|iex"
scoop
scoop install bun
brew
brew tap oven-sh/bun
brew install bun
docker
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun

To upgrade Bun:

bun upgrade

Windows support improvements

Up to 50% faster bun install on Windows

In this release, bun install gets up to 50% faster at installing packages on Windows compared to Bun v1.1.2 and earlier.

For an application which has next, SvelteKit, and a handful more in package.json:

PS > hyperfine "bun install --ignore-scripts" "bun-1.1.2.exe install --ignore-scripts" --prepare="rm -r node_modules || true" --warmup=2

Benchmark 1: bun install --ignore-scripts # New
  Time (mean ± σ):     720.7 ms ±  39.8 ms    [User: 20.3 ms, System: 423.4 ms]
  Range (min … max):   676.4 ms … 801.9 ms    10 runs

Benchmark 2: bun-1.1.2.exe install --ignore-scripts # Old
  Time (mean ± σ):      1.158 s ±  0.017 s    [User: 0.011 s, System: 0.419 s]
  Range (min … max):    1.135 s …  1.180 s    10 runs

Summary
  bun install --ignore-scripts ran
    1.61 ± 0.09 times faster than bun-1.1.2.exe install --ignore-scripts

We've paralellized some of where bun install copies/hardlinks files on Windows, but not all of them.

Bun for Windows is still compiled using ReleaseSafe mode which adds runtime safety checks that can cause some performance issues. Once there are fewer bug reports in bundows, we'll switch to ReleaseFast mode.

Fixed: CTRL + C on cmd.exe after exiting bun

One difference between cmd.exe and PowerShell is the console mode. On exit, PowerShell always resets the console mode. Command Prompt (cmd.exe) does not.

Previously, bun wasn't resetting the console mode on exit. This would cause issues with pressing Up or Down arrows in Command Prompt after exiting bun.

This has been fixed.

Fixed: Potential crash when loading modules without permissions

A bug that could cause loading a JavaScript or TypeScript file to crash if the file was not readable has been fixed.

This bug was caused by assuming the permission was accessible when it wasn't.

bun install improvements

Fixed: Spurious "Install failed" error

When installing packages with a nested node_modules folder where the parent package needs to be downloaded along with a number of more subtle conditions, bun install would sometimes fail with an "Install failed" error.

This has been fixed.

Fixed: Non-zero exit code after errors

Some errors in bun install didn't cause bun to exit with a non-zero exit code. This has been fixed.

Most of the errors where this would happen had to do with filesystem permissions.

Fixed: Potential deadlock in bun install

A rare deadlock in bun install has been fixed. This would happen potentially if many packages finished extracting at the exact same time and for some reason the main thread did not wake up when notified.

Thanks to 5 contributors!