---
title: Bun v1.1.5
description: "Fixes 64 bugs (addressing 101 👍). Cross-compile standalone JavaScript & TypeScript executables to other platforms with bun build --compile. import any file as text via the `type: 'text'` import attribute. Introduces a new crash reporter. package.json with comments and trailing commas. Fixes a bug where `bun run --filter` exited with 0. Fixes a bug in bun install with file: dependencies. Fixes bugs in `node:tls`, `node:crypto`, `node:readline`, `node:http`, `node:worker_threads`"
date: "2024-04-26T23:13:58+00:00"
author: ashcon
draft: false
---

> Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager &mdash; all in one.

Bun v1.1.5 fixes 64 bugs (addressing 101 👍). bun build --compile cross-compile standalone JavaScript & TypeScript executables to other platforms. import any file as text via the `type: "text"` import attribute. Introduces a new crash reporter. `package.json` doesn't error with comments or trailing commas. Fixes a bug where `bun run --filter` exited with 0. Fixes a bug in bun install with file: dependencies. Fixes bugs in `node:fs`, `node:tls`, `node:crypto`, `node:readline`, `node:http`, `node:worker_threads`.

#### Previous releases

- [`v1.1.4`](/blog/bun-v1.1.4) Bun v1.1.4 fixes 40 bugs (addressing 84 👍 reactions). `bun run --filter <workspace> <script>` lets you run multiple workspace scripts in parallel. Reinstalls get up to 50% faster in bun install. Important reliability fixes to bun install. bun:sqlite supports `using` for resource cleanup and has a few bugfixes. Memory leak impacting Next.js Standalone & Web Streams is fixed. Node.js compatibility improvements `fs` and `child_process`. Fix for "Connection closed" in fetch(). A few bugfixes for Bundows.
- [`v1.1.3`](/blog/bun-v1.1.3) 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.
- [`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
```

## Cross-compile standalone executables with `bun build --compile`

[Standalone executables](https://bun.sh/docs/bundler/executables) in Bun now support cross-compilation.

To cross-compile a TypeScript or JavaScript application to a different platform, use the `--target` option with `bun build --compile`:

```sh
# Linux x64
bun build --compile --target=bun-linux-x64 app.ts

# Windows x64
bun build --compile --target=bun-windows-x64 app.ts

# macOS Silicon
bun build --compile --target=bun-darwin-arm64 app.ts

# Linux arm64
bun build --compile --target=bun-linux-arm64 app.ts
```

`bun build --compile` bundles & tree-shakes your entire application (including used node_modules), plus Bun into a single executable that can be run on the target platform without dependencies.

This makes it simpler to deploy Bun to production.

- Build your app on your development machine and deploy it to a different platform without needing to install Bun on the target machine
- Build in Docker on Linux x64 and run on Linux arm64.
- Build a macOS CLI tool on a Linux machine, or a Windows CLI tool on a Macbook Pro.
- Your CI/CD pipeline can build a CLI tool for all platforms without needing to maintain multiple build machines.

## package.json with comments and trailing commas

Have you ever added something in `package.json` and forgot why 6 months later? Or wanted to explain to teammates why we need to use a specific version of a dependency? Have you ever had a merge conflict in a package.json file due to a comma?

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">What JS ecosystem upgrade path would you prefer to permit comments in package.json?</p>&mdash; Rob Palmer (@robpalmer2) <a href="https://twitter.com/robpalmer2/status/1780495081637548305?ref_src=twsrc%5Etfw">April 17, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

As of Bun v1.1.5, `bun install`, `bun run <script>`, `bun <file>`, and `bun build` no longer error when you use comments or trailing commas in package.json.

This package.json file will no longer error:

```js#package.json
{
  "name": "app",
  "dependencies": {
    // We need 0.30.8 because of a bug in 0.30.9
    "drizzle-orm": "0.30.8",
  },
}
```

This aligns the behavior of `package.json` in Bun with other popular JSON configuration files like TypeScript's `tsconfig.json` and `jsconfig.json`.

We know there many other tools that read package.json. To make this easier for other tools, we've added support for `require` and `import` to load package.json files with comments and trailing commas. This works in TypeScript files, JavaScript files in `bun build` and at runtime.

```js
const pkg = require("./package.json");
const {
  default: { name },
} = await import("./package.json");
```

For ecosystem compatibility, we don't recommend using this feature. But who knows, maybe one day it'll [get standardized](https://twitter.com/NicoloRibaudo/status/1780240914562056360) in the JSON spec.

### bun.report is Bun's new crash reporter

To help us debug panics and crashes, we've implemented a compact new stack trace format for Zig and C++ crash reports. The crash report fits in a ~150 byte URL.

We wrote a whole blog post on this new feature, [bun.report is Bun's new crash reporter](/blog/bun-report-is-buns-new-crash-reporter).

{% raw %}

<a target="_blank" href="https://bun.sh/blog/bun-report-is-buns-new-crash-reporter">

<img src="/images/crash-report-1.png" width="100%" alt="bun.report is Bun's new crash reporter" />

</a>

{% /raw %}

### New: import any file as text

You can now import any file as a string using the `type: "text"` import attribute. This is useful when you want to import a file as a string, even if it doesn't have a `.txt` extension.

Like other imports in Bun, `text` imports support hot reloading and watch mode, so when you start Bun with `--hot` or `--watch`, Bun automatically reloads the file when it changes.

```js
import html from "./index.html" with type { type: "text" };

console.log(html);
```

When used with `bun build --compile`, this embeds the file as a string in the executable.

Import Attributes are a [TC39 stage3 proposal](https://github.com/tc39/proposal-import-attributes) with implementations in multiple JavaScript engines.

##### toml, json, and file import attributes

We've also added support for the following import attributes:

- `json`
- `toml`
- `file`

Previously, a `--loader` needed to be passed to configure this behavior. Now you can use these import attributes directly.

```js
// its a .foo file, but `type` makes it read as JSON
import json from "./config.foo" with { type: "json" };

// there's no toml extension, but `type` makes it read as toml.
import cfg from "./Configfile" with { type: "toml" };

console.log(cfg); // { "name": "app" }
console.log(json); // { "name": "app" } (converted to JSON object)
```

### Bun.serve() now supports Server Name Indication (SNI)

You can now specify multiple `serverName` TLS entries in `Bun.serve`. This is useful when you want to serve multiple TLS certificates or hostnames on the same port.

```js
import { serve } from "bun";

serve({
  port: 443,
  tls: [
    {
      cert: Bun.file("./example.pem"),
      key: Bun.file("./example-key.pem"),
      serverName: "*.example.com",
    },
    {
      cert: Bun.file("./test.pem"),
      key: Bun.file("./test-key.pem"),
      serverName: "*.test.com",
    },
  ],
  fetch(request) {
    return new Response("Using TLS!");
  },
});
```

This also fixed a bug where `serverName` would not work, even with a single entry. Thanks to [@cirospaciari](https://github.com/cirospaciari) for fixing this bug.

### Fixed: `bun run --filter` always exited with 0

In Bun v1.1.4, we introduced [`bun run --filter`](/blog/bun-v1.1.4#bun-filter-runs-workspace-scripts-in-parallel) which allows you to run multiple scripts in parallel. We fixed a bug where the `--filter` option was not returning a non-zero exit code when one of the scripts failed.

```json#package.json
{
  "scripts": {
    "pass": "exit 0",
    "fail": "exit 1"
  }
}
```

```sh
$ bun run --filter "*"
$ echo $?
# Before: 0
# After: 1
```

Thanks to [@gvilums](https://github.com/gvilums) for fixing this bug.

### Fixed: Absolute patterns in `Bun.Glob` not working

There was a bug where glob patterns that contained an absolute path would not work with `Bun.Glob`.

```js
import { Glob } from "bun";

const glob = new Glob("/tmp/*");
const matches = [...glob.scanSync("/tmp")];

console.log(matches.length);
// Before: 0 (incorrect)
// After: > 0 (correct)
```

Thanks to [@zackradisic](https://github.com/zackradisic) for fixing this bug.

### Fixed: `bun build --compile` sometimes not respecting `--outfile`

There was a bug in `bun build --compile` that caused it to not respect the `--outfile` option when there was an external file that was being imported.

```js#app.ts
import file from "./file.png";
```

```sh
$ bun build --compile app.ts --outfile build/app
# Before:
$ ./app
# After:
$ ./build/app
```

This has now been fixed.

### Fixed: `dlopen` would not work file `file://` URLs

We fixed a bug with `bun:ffi` where `dlopen` would not work with `file://` URLs. This was previously fixed with `process.dlopen`, but we missed it in `bun:ffi`.

This changed was made to make it easier to pass values directly from `import.meta.url`.

```js
import { dlopen } from "bun:ffi";

const lib = dlopen(import.meta.resolve("./lib.so") /* ... symbols */);
```

We've also added support `bun build --compile` support for loading embedded `.dylib`, `.so`, and `.dll` files with `bun:ffi`. So you can embed native libraries into your standalone executables (which can also be cross-compiled from a different platform).

### Fixed: `npm install -g bun` installs non-baseline build on Windows

There was a bug in the script that runs on `npm install -g bun` that caused it to always install the baseline build on Windows, even if your machine supported non-baseline builds.

This has been fixed thanks to [@liudonghua123](https://github.com/liudonghua123).

### Fixed: `bun build --define` not working with nested identifiers

There was a bug where `bun build --define` would incorrectly quote nested identifiers, preventing them from working properly.

```js#app.js
console.log("hello!");
```

Before:

```sh
$ bun build --define "console.log=console.error"
# "console.error"("hello!");
```

After:

```sh
$ bun build --define "console.log=console.error"
# console.error("hello!");
```

Thanks to [@erikbrinkman](https://github.com/erikbrinkman) for fixing this bug.

### Fixed: bun install with interesting file: URLs

A bug where certain invalid `file:` URLs npm supports were not supported by `bun install` has been fixed, thanks to [@dylan-conway](https://github.com/dylan-conway).

### Fixed: Bun.spawn error handling on Linux

Some Linux environments disable `pidfd_open` in surprising ways. When calling `pidfd_open`, we correctly handled `ENOSYS` before, but in this release we've made it treat `EPERM`, `EACCES` and a few other errors similarly to `ENOSYS` as well. We've also fixed a [race condition](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use) when a process exiting between spawning and opening the pidfd. This may fix some rare crashes on Linux in environments like GitLab CI.

## Node.js compatibility improvements

This release also includes several Node.js compatibility improvements.

### Fixed: `postMessage` in worker_threads works when self.postMessage is overridden

Bun implements the Node.js `worker_threads` module on top of the Web `Worker` API. Previously, a package overriding `self.postMessage` in a worker could cause `worker_threads` to not post messages correctly. This has been fixed, thanks to [@paperclover](https://github.com/paperclover).

### Fixed: node:http client event emit order

The order of events emitted by `node:http` client has been fixed to match Node.js, thanks to [@nektro](https://github.com/nektro).

### Fixed: `fs.existsSync` should never throw an error

To match Node.js, we changed [`fs.existsSync`]() to never throw an error, even when presented with invalid input. Here is a [comment](https://github.com/nodejs/node/blob/c82f3c9e80f0eeec4ae5b7aedd1183127abda4ad/lib/fs.js#L275-L279) explaining why from the source code of Node.js:

```js
// fs.existsSync never throws, it only returns true or false.
// Since fs.existsSync never throws, users have established
// the expectation that passing invalid arguments to it, even like
// fs.existsSync(), would only get a false in return, so we cannot signal
// validation errors to users properly out of compatibility concerns.
```

```js
import { existsSync } from "node:fs";

existsSync(); // false
existsSync({ not: "a", valid: "path" }); // false
existsSync(-10281); // false
```

### Fixed: `Invalid stdio option` in `child_process.spawn`

Previously, Bun would throw an error when passing a `ReadableStream`, like `process.stdin`, when spawning a subprocess using `child_process`.

```js
import { spawn } from "child_process";

const child = spawn("echo", ["hello"], {
  stdio: [process.stdin, process.stdout, process.stderr],
});
```

The following error has been fixed, thanks to [@nektro](https://github.com/nektro).

```sh
1 | import { spawn } from "child_process";
2 |
3 | const child = spawn("echo", ["hello"], {
                        ^
error: Invalid stdio option "[object ReadStream]"
```

#### Fixed: `npm-run-all` now works

This also fixed a bug that prevented `npm-run-all` from working with Bun.

```json
{
  "name": "app",
  "dependencies": {
    "npm-run-all": "^4"
  },
  "scripts": {
    "all": "npm-run-all --parallel dev build",
    "dev": "echo 'Running dev!'",
    "build": "echo 'Running build!'"
  }
}
```

Before:

```sh
$ bun --bun run all
$ npm-run-all --parallel dev build
ERROR: Invalid stdio option "[object ReadStream]"
error: script "all" exited with code 1
```

After:

```sh
$ bun --bun run all
$ npm-run-all --parallel dev build
$ echo 'Running dev!'
$ echo 'Running build!'
Running dev!
Running build!
```

### Fixed: Support for `sha3` and other crypto algorithms

Bun now supports the folowing crypto algorithms, to match support in Node.js:

- `sha3-224`
- `sha3-256`
- `sha3-384`
- `sha3-512`
- `sha512-224`
- `blake2b512`

```js
import { createHash } from "crypto";

const hash = createHash("sha3-256");
hash.update("hello");
console.log(hash.digest("hex"));
```

### Fixed: edgecase in fs.readSync arguments

A bug where fs.readSync when passed offset and length arguments with no position has been fixed, thanks to [@nektro](https://github.com/nektro).

## Bun for Windows improvements

### Fixed: Up/down arrow keys not working in readline

A bug caused Bun to not correctly handle special keys like up and down arrow keys in `readline`.

This bug was caused by creating multiple instances of a `uv_tty_t` struct for the same file descriptor. We fixed this by avoiding this situation when the `fd` is stdin.

Thanks to [@paperclover](https://github.com/paperclover) for fixing this bug.

### Fixed: potential hang in fs.watch on Windows

A bug caused Bun to potentially hang when using `fs.watch` on Windows. This has been fixed, thanks to [@paperclover](https://github.com/paperclover).

### Fixed: bun upgrade on Windows

`bun upgrade` would sometimes not work on Windows due to a permissions error. We've fixed the permissions error, thanks to [@dylan-conway](https://github.com/dylan-conway).

### Fixed: Rare crash on Windows when the process exits

There was a rare crash that could occur on Windows where an exception would occur in a global C++ destructor, which would cause the process to crash.

This was hard to reproduce, but we fixed it thanks to [@dylan-conway](https://github.com/dylan-conway).

### Fixed: Crash in Bun.escapeHTML on non-SIMD CPUs in certain cases

A crash that could occur in `Bun.escapeHTML` on non-SIMD CPUs in certain cases has been fixed.

### Fixed: `bunx` without `.exe` not working on Windows

There was a bug in Bun that caused it to not work on Windows if `bunx` was run without the `.exe` extension. The following error has been fixed:

```sh
$ bunx cowsay "Hello, world!"
error: Script not found "cowsay"
```

Thanks to [@dylan-conway](https://github.com/dylan-conway) for fixing this bug.

### Fixed: bun install re-link workspaces on Windows

A bug where `bun install` would potentially return `EEXISTS` when re-linking workspaces on Windows has been fixed, thanks to [@dylan-conway](https://github.com/dylan-conway).

### Upgraded BoringSSL

We upgraded BoringSSL to the latest version.

### Upgraded Mimalloc

We upgraded Mimalloc, the memory allocator used in Bun, to the latest version.

### Upgraded JavaScriptCore

We upgraded JavaScriptCore and that brings with it some optimizations to string concatenation.

## Thank you to 16 contributors!

- [@boyer-victor](https://github.com/boyer-victor)
- [@cirospaciari](https://github.com/cirospaciari)
- [@Deckluhm](https://github.com/Deckluhm)
- [@dylan-conway](https://github.com/dylan-conway)
- [@Electroid](https://github.com/Electroid)
- [@erikbrinkman](https://github.com/erikbrinkman)
- [@gvilums](https://github.com/gvilums)
- [@Jarred-Sumner](https://github.com/Jarred-Sumner)
- [@jwigert](https://github.com/jwigert)
- [@lafkpages](https://github.com/lafkpages)
- [@liudonghua123](https://github.com/liudonghua123)
- [@nektro](https://github.com/nektro)
- [@paperclover](https://github.com/paperclover)
- [@tuttarealstep](https://github.com/tuttarealstep)
- [@welfuture](https://github.com/welfuture)
- [@zackradisic](https://github.com/zackradisic)
