---
title: Bun v1.1.19
description: "Fixes 54 bugs (addressing 248 👍). JavaScript gets faster on Windows. Raspberry Pi 4 support returns. `_auth` support in `.npmrc`. `bun install` preserves package.json indentation. `aws-cdk-lib` support. Memory leak fixes in `new Response(request)` and `fs.readdir`. Several reliability improvements. Statically linked UCRT on Windows."
date: "2024-07-12T21:47:25.766Z"
author: dylan
---

Bun v1.1.19 is here! This release fixes 54 bugs (addressing 248 👍). JavaScript gets faster on Windows. Raspberry Pi 4 support returns. `_auth` support in `.npmrc`. `bun install` preserves package.json indentation. `aws-cdk-lib` support. Memory leak fixes in `new Response(request)` and `fs.readdir`. Several reliability improvements. Statically linked UCRT on Windows.

{% callout %}
We're hiring [systems engineers](/careers) in San Francisco to build the future of JavaScript!
{% /callout %}

#### Previous releases

- [`v1.1.18`](/blog/bun-v1.1.18) Fixes 55 bugs (addressing 493 👍). Support for npmrc. Improved constant folding & enum inlining. Improved console.log output for functions. Fixes patching dependencies in workspaces. Fixes several bugs in `bun install` when linking binaries. Fixes a crash in `dns.lookup`, and normalizes DNS errors to better match Node. Fixes an assertion failure in `Bun.escapeHTML`. Upgrades JavaScriptCore.
- [`v1.1.17`](/blog/bun-v1.1.17) Fixes 4 bugs. Fixes a crash in bun repl. Makes fs.readdirSync 5% faster on macOS in small directories. Fixes "ws" module not calling the callback in "send" method. Fixes a crash when reading a corrupted lockfile in bun install. Makes macOS event loop a smidge faster.
- [`v1.1.0`](/blog/bun-v1.1) Bundows. Windows support is here!

#### To install Bun

{% codetabs %}

```sh#curl
$ curl -fsSL https://bun.sh/install | bash
```

```sh#npm
$ npm install -g bun
```

```sh#powershell
$ powershell -c "irm bun.sh/install.ps1|iex"
```

```sh#scoop
$ scoop install bun
```

```sh#brew
$ brew tap oven-sh/bun
$ brew install bun
```

```sh#docker
$ docker pull oven/bun
$ docker run --rm --init --ulimit memlock=-1:-1 oven/bun
```

{% /codetabs %}

#### To upgrade Bun

```sh
$ bun upgrade
```

## JavaScript gets faster on Windows

This release enables WebKit's [FTL JIT (Faster Than Light Just In Time Compiler)](https://www.webkit.org/blog/5852/introducing-the-b3-jit-compiler/) on Windows, which improves hot path performance. Previously, this JIT was only available on macOS and Linux.

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">9 years ago, JavaScriptCore&#39;s FTL JIT was disabled on Windows<br><br>Today, <a href="https://twitter.com/iangrunert?ref_src=twsrc%5Etfw">@iangrunert</a> brought it back<a href="https://t.co/xY5078Zlk6">https://t.co/xY5078Zlk6</a></p>&mdash; Jarred Sumner (@jarredsumner) <a href="https://twitter.com/jarredsumner/status/1810497635624890391?ref_src=twsrc%5Etfw">July 9, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

`Object.entries` gets about 20% faster:

| Runtime      | benchmark               | time (avg)    |
| ------------ | ----------------------- | ------------- |
| Bun v1.1.19  | Object.entries(26 keys) | 726 ns/iter   |
| Bun v1.1.18  | Object.entries(26 keys) | 1'006 ns/iter |
| Node v22.4.1 | Object.entries(26 keys) | 1'014 ns/iter |
| Bun v1.1.19  | Object.entries(2 keys)  | 55.99 ns/iter |
| Bun v1.1.18  | Object.entries(2 keys)  | 114 ns/iter   |
| Node v22.4.1 | Object.entries(2 keys)  | 115 ns/iter   |
| Node v22.4.1 | Object.keys(26 keys)    | 206 ns/iter   |
| Bun v1.1.19  | Object.keys(26 keys)    | 509 ns/iter   |
| Bun v1.1.18  | Object.keys(26 keys)    | 671 ns/iter |

`Array.map` overhead drops by about 50%:

| Runtime      | benchmark          | time (avg)    |
| ------------ | ------------------ | ------------- |
| Bun v1.1.19  | Array.map x 1 args | 31.23 ns/iter |
| Bun v1.1.18  | Array.map x 1 args | 58.32 ns/iter |
| Node v22.4.1 | Array.map x 1 args | 84.27 ns/iter |
| Bun v1.1.19  | Array.map x 2 args | 30.42 ns/iter |
| Bun v1.1.18  | Array.map x 2 args | 56.96 ns/iter |
| Node v22.4.1 | Array.map x 2 args | 84.87 ns/iter |

And so much more. JavaScriptCore's FTL JIT is 25,000 lines of C++ -- it does a lot.

```ts
===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 C Header               46         4436         2407         1264          765
 C++                    35        29919        23306         1925         4688
===============================================================================
 Total                  81        34355        25713         3189         5453
```

Huge thanks to [@iangrunert](https://github.com/iangrunert)!

## Raspberry Pi 4

Bun once again supports Raspberry Pi 4. A build issue preventing Bun from running on the Raspberry Pi 4 has been fixed.

{% image src="https://github.com/user-attachments/assets/38763218-bdc0-4474-94d8-c950e8302ca7" alt="Raspberry Pi 4" /%}

## 1 MB smaller on Linux

We've enabled a link-time optimization that makes Bun 1 MB smaller on Linux.

## Statically-linked Windows build

On Windows, Bun will now use a statically linked copy of UCRT. This means you don't need the Visual C++ runtime installed to run Bun.

## bun install improvements

### `bun install` respects `package.json` indentation

Space and tab indentation in `package.json` is now preserved when saving new dependencies with Bun.

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">In the next version of Bun<br><br>bun install preserves tabs &amp; indentation when saving package.json <a href="https://t.co/9FqcdebuUY">pic.twitter.com/9FqcdebuUY</a></p>&mdash; Bun (@bunjavascript) <a href="https://twitter.com/bunjavascript/status/1808759441497731276?ref_src=twsrc%5Etfw">July 4, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

Thanks to [@dylan-conway](https://github.com/dylan-conway)!

### `bun install` supports `_auth` in `.npmrc`

`bun install` now supports the `_auth` option in `.npmrc` files. This is useful for providing both username and password together.

```ini#.npmrc
//http://localhost:4873/:_auth=${NPM_AUTH}
```

Thanks to [@zackradisic](https://github.com/zackradisic)!

### Fixed: crash with optional peer dependencies

During an install with optional peer dependencies, sometimes Bun would crash. To reproduce this crash, one would need this `package.json`

```json#package.json
{
    "dependencies": {
        "a": "1.0.0",
        "b": "1.0.0",
    }
}
```

with these dependencies:

```json
{
  "name": "a",
  "version": "1.0.0"
}
```

```json
{
  "name": "b",
  "version": "1.0.0",
  "peerDependencies": {
    "a": "1.0.0"
  },
  "peerDependenciesMeta": {
    "a": {
      "optional": true
    }
  }
}
```

The crash would occur after running `bun install`, deleting `node_modules` and cache (`bun pm cache rm`), bumping `b` to a newer version that still has an optional peer dependency on `a`, then running `bun install` again with the existing lockfile.

There are more than a few steps to reproduce this crash, but it was a common issue with packages like `vite` or `vue` due to their use of optional peer dependencies.

This is now fixed, thanks to [@dylan-conway](https://github.com/dylan-conway)!

### Warn when binaries from `bun install -g` are not in path

When the global bin folder isn't in path, Bun will now print a warning and a suggestion to add the folder to path.

```
bun add v1.1.19 (18a0f05c)

installed node-gyp@10.2.0 with binaries:
 - node-gyp

warn: To run "node-gyp", add the global bin folder to $PATH:

fish_add_path "/Users/jarred/.bun/bin"
```

### Fixed: cwd for symlinked dependency postinstall scripts on Windows

Before running a postinstall script, the cwd is set to the package directory in `node_modules`. When the package is a workspace, the directory in `node_modules` is a symlink to the workspace. On posix this is fine - the symlink is resolved and `process.cwd()` prints the absolute path through the project root. On Windows, the symlink is not resolved, resulting in an unexpected cwd of `C:/path/to/proj/node_modules/workspace` instead of `C:/path/to/proj/workspace`.

Now, Bun resolves these paths manually on Windows to ensure the cwd is the expected path.

Thanks to [@dylan-conway](https://github.com/dylan-conway)!

## Transpiler improvements

### Improved: Comma expression folding

Bun no longer uses recursion when folding comma separated expressions in JavaScript/TypeScript, reducing the risk of stack overflow. This fixes crashes when using some libraries like `aws-cdk-lib` and `aws-sdk`.

Thanks to [@paperclover](https://github.com/paperclover)!

### Fixed: invalid transpilation of nested TypeScript `namespace` declarations

A TypeScript transpilation bug has been fixed where nested `namespace`s were incorrectly transpiled, resulting in exports not being available. This could happen if they were non-inlined namespaces.

```ts
export namespace Foo.Bar {
  export function bar() {
    return "hello world";
  }
}

console.log(Foo.Bar.bar()); // "hello world"
```

This is fixed thanks to [@paperclover](https://github.com/paperclover)!

## Reliability improvements

### Fixed: `afterEach` callback running for `test.todo`

Previously, `afterEach` was running for each `test.todo`, causing the following code to fail. This is now fixed. `test.todo` will continue to trigger `afterEach` and `beforeEach` if `--todo` is used.

```ts
import { test, expect, afterEach } from "bun:test";

let count: number = 0;

afterEach(() => {
  count++;
});

test.todo("todo");

test("afterEach should not run for test.todo", () => {
  expect(count).toBe(0);
});
```

Thanks to [@ThatOneBro](https://github.com/ThatOneBro)!

### Fixed: memory leak in `new Request(request)`

When passing a `Request` instance to the `Request` constructor, the `Request` constructor would leak memory. This is now fixed.

```ts
const old = new Request("https://example.com", { body: "hello!" });

// This would leak memory:
const req = new Request(old);
```

This was only a problem when passing a `Request` instance to the `Request` constructor. Passing a `Request` instance to `fetch` was not affected, nor was passing an object shaped like a `Request` instance.

### Fixed: crash when sending large files with `Bun.serve`

When sending a large file with `Bun.serve` and the process is killed with `process.kill` or the request is aborted, Bun would sometimes crash. This has been fixed, thanks to [@cirospaciari](https://github.com/cirospaciari)!

### Fixed: crash in remapping stack frames with `bun build`

There was a double free on a string when using `bun build --sourcemap=external --target=bun`, causing a segfault.

This is now fixed, thanks to [@paperclover](https://github.com/paperclover)!

### Fixed: `AbortSignal` reliability improvement with `fetch()`

When cancelling a request with `AbortSignal` in `fetch()`, sometimes it wouldn't cancel for HTTPS requests until after the response had completed. This bug is now fixed. An incorrect option in our BoringSSL integration caused it to ignore TCP shutdown calls.

Thanks to [@cirospaciari](https://github.com/cirospaciari)!

### Improved: `profile` from `bun:jsc` now supports promises

In Bun v1.1.19 you will now be able to pass promises to `profile`.

```js
import { profile } from "bun:jsc";
const { promise, resolve } = Promise.withResolvers();
const result = await profile(
  async function test(input: string) {
    await Bun.sleep(10).then(() => resolve(input));
  },
  1,
  "input",
);
const input = await promise;
console.log(input); // { "0": "input" }
```

### Fixed: `FormData.set` settings file name incorrectly

A bug has been fixed where `FormData` would incorrectly set file names with `.set`. This code will now work as expected, thanks to [@billywhizz](https://github.com/billywhizz)!

```js
using server = Bun.serve({
    port: 0,
    fetch: async req => {
        const data = await req.formData();
        const file = data.get("file");
        console.log(file.name); // foo.txt
        return new Response();
    }
})

const form = new FormData();
form.set("file", new File(["hello"], "foo.txt"));
await fetch(server.url, { method: "POST", body: form });
```

## Node.js compatibility improvements

### fs errors

This release fixes argument validation issues in `node:fs`.

Previously, the following code would throw a confusing error:

```ts
import { fs } from "fs";

fs.open("path");
```

Previous error:

```ts#bun-1.1.18.ts
1 | fs.open("path")
       ^
TypeError: path must be a string or TypedArray
 code: "ERR_INVALID_ARG_TYPE"

      at node:fs:36:26
      at open2 (node:fs:276:25)
      at path-to-file.ts:1:4
```

Now, the error correctly mentions the missing callback:

```ts#bun-1.1.19.ts
1 | fs.open("path")
       ^
TypeError: The "cb" argument must be of type function. Received undefined
 code: "ERR_INVALID_ARG_TYPE"

      at node:fs:2:30
      at open (node:fs:288:25)
      at path-to-file.ts:1:4
```

### fs.write argument fix

Previously, the following input would incorrectly throw an error:

```ts
import fs from "fs";

fs.write(1, Buffer.from("hi"), 0, console.log, undefined);
```

Now it works as expected, consistent with Node.js.

Previously, this threw an error about a missing callback:

```ts
1 | fs.write(1, Buffer.from("hi"), 0, console.log, undefined)
       ^
TypeError: Callback must be a function
 code: "ERR_INVALID_ARG_TYPE"
      at node:fs:2:30
      at write2 (node:fs:297:27)
```

### Fixed: memory leak in `fs.readdir` `withFileTypes: true`

When calling `fs.readdir` with `withFileTypes: true`, the `path` property was leaking memory while directory entries were being read. This is now fixed, thanks to [@billywhizz](https://github.com/billywhizz)!

### Thanks to 25 contributors!

- [@0livare](https://github.com/0livare)
- [@billywhizz](https://github.com/billywhizz)
- [@bjon](https://github.com/bjon)
- [@cirospaciari](https://github.com/cirospaciari)
- [@dylan-conway](https://github.com/dylan-conway)
- [@farcaller](https://github.com/farcaller)
- [@ghoshArnab](https://github.com/ghoshArnab)
- [@Imgodmaoyouknow](https://github.com/Imgodmaoyouknow)
- [@jakeboone02](https://github.com/jakeboone02)
- [@Jarred-Sumner](https://github.com/Jarred-Sumner)
- [@kdrag0n](https://github.com/kdrag0n)
- [@lmmfranco](https://github.com/lmmfranco)
- [@otecd](https://github.com/otecd)
- [@paperclover](https://github.com/paperclover)
- [@Ptitet](https://github.com/Ptitet)
- [@rista404](https://github.com/rista404)
- [@ryuujo1573](https://github.com/ryuujo1573)
- [@silverwind](https://github.com/silverwind)
- [@speelbarrow](https://github.com/speelbarrow)
- [@ThatOneBro](https://github.com/ThatOneBro)
- [@trcio](https://github.com/trcio)
- [@vadzim](https://github.com/vadzim)
- [@victor-homyakov](https://github.com/victor-homyakov)
- [@zackradisic](https://github.com/zackradisic)
- [@zpix1](https://github.com/zpix1)
