---
title: Bun v1.0.3
description: emitDecoratorMetadata, Nest.js support, better private registry support, bunx bugfix, console.log() depth 8 -> 2, silence .env loaded message, and many bugfixes
date: "2023-09-22T12:00:00.000Z"
author: colin
draft: false
---

Bun v1.0.3 fixes numerous bugs, adds support for metadata reflection via TypeScript's [`emitDecoratorMetadata`](https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata), improves `fetch` compatibility, unblocks private registries like Azure Artifacts and Artifactory, bunx bugfix, console.log() depth 8 -> 2, Node.js compatibility improvements, and more.

Thank you for reporting issues. We are working hard to fix them as quickly as possible.

Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager &mdash; all in one. We've been releasing a lot of changes to Bun recently. Here's a recap of the last few releases. In case you missed it:

- [`v1.0.0`](/blog/bun-v1.0) - Bun's first stable release!
- [`v1.0.1`](/blog/bun-v1.0.1) - Named imports for .json & .toml files, bugfixes to bun install, node:path, Buffer
- [`v1.0.2`](/blog/bun-v1.0.2) - Make `--watch` faster, plus bug fixes

To install Bun:

{% codetabs %}

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

```sh#npm
$ npm install -g 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
```

## `emitDecoratorMetadata` (used by Nest.js, TypeORM, and more)

Bun now supports metadata reflection via TypeScript's [`emitDecoratorMetadata`](https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata). This means that you can use Nest.js with Bun, and it will work out of the box.

```json#tsconfig.json
{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  }
}
```

The `emitDecoratorMetadata` is a TypeScript compiler option that enables the generation of metadata for decorators via [reflect-metadata](https://www.npmjs.com/package/reflect-metadata).

## Improved Nest.js support

The addition of `emitDecoratorMetadata` dramatically improves Nest.js support, as it relies on custom ["Reflectors"](https://docs.nestjs.com/fundamentals/execution-context#reflection-and-metadata) to attach metadata and middleware to route handlers.

```ts
@Post()
@Roles(['admin']) // custom authentication decorator
async create(@Body() createCatDto: CreateCatDto) {
  this.catsService.create(createCatDto);
}
```

## `module.parent` support

In Node, the CommonJS `module.parent` getter is a reference to the parent module that required the current module. This is useful for determining whether a module was run directly or required by another module.

```ts
if (module.parent) {
  // this module was required by another module
} else {
  // this module was run directly
}
```

Bun now supports `module.parent` in the same way that Node does.

For ES modules, you can use `import.meta.main` to find out if the current module started the Bun process.

## Bugfixes for private npm registries

Improvements to [`fetch`](https://github.com/oven-sh/bun/pull/5729) unblock the usage of `bun install` with popular private package registries like Azure Artifacts and JFrog Artifactory.

You can configure a private registry using `bunfig.toml` instead of `.npmrc`. Provide values for `url`, `username`, and `password` under the `[install.registry]` section of your `bunfig.toml` file.

```toml#bunfig.toml
[install.registry]
url = "https://pkgs.dev.azure.com/my-azure-artifacts-user/_packaging/my-azure-artifacts-user/npm/registry"
username = "my-azure-artifacts-user"
# Bun v1.0.3+ supports using an environment variable here
password = "$NPM_PASSWORD"
```

Alternatively, specify a token instead of a username and password. This is useful for Artifactory.

```toml#bunfig.toml
[install.registry]
url = "https://my-artifactory-server.com/artifactory/api/npm/npm-virtual"
token = "$NPM_TOKEN"
```

For more complete information, refer to our new guides:

- [Using `bun install` with Artifactory](/guides/install/jfrog-artifactory)
- [Using `bun install` with Azure Artifacts](/guides/install/azure-artifacts)

## `[0.5ms] env` message is now silent by default

Many people asked for this, so @colinhacks made it happen. The `[0.5ms] env loaded` message is now silent by default. You can still see it by setting `logLevel` to `"debug"` in `bunfig.toml`

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">in the next version of bun<br><br>[0.1ms] &quot;.env&quot; is silenced by default <a href="https://t.co/F7V6hGZvrV">pic.twitter.com/F7V6hGZvrV</a></p>&mdash; Jarred Sumner (@jarredsumner) <a href="https://twitter.com/jarredsumner/status/1705102614793474448?ref_src=twsrc%5Etfw">September 22, 2023</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

## Node.js compatiblity improvements

The work on Node.js compatibility continues. Here are some of the improvements in this release:

### Implement `console.Console` constructor

The Node.js `console.Console` constructor has been implemented.

```ts
import { Console } from "console";
import { createWriteStream } from "fs";

const writer = new Console({ stdout: createWriteStream("log.txt") });

writer.log("hello");
writer.log("world", { x: 2 });
```

This fixes [`vitest`](https://github.com/oven-sh/bun/issues/4145) and webpack's [`ts-loader`](https://github.com/oven-sh/bun/issues/5558) when executed with the Bun runtime—though consider using `bun test` and `bun build` instead! Of course, there are a lot of tools and codebases that rely on these technologies which will now work with Bun.

#### Empty environment variables now appear as an empty string (`""`)

In `process.env` and `Bun.env`, empty environment variables appeared as `undefined` instead of an empty string. This is fixed, thanks to [@liz3](https://github.com/liz3).

#### `dns.lookupService` is now implemented

The `node:dns` function `dns.lookupService` is now implemented. Thanks to [@Hanaasagi](https://github.com/Hanaasagi).

#### console.log() depth is now 2 instead of 8

8 was nice, but caused issues with large objects filling up your terminal screen. Thanks to [@JibranKalia](https://github.com/JibranKalia). This aligns the behavior with Node.js.

#### node_api_create_external_string_latin1 and node_api_create_external_string_utf16

The node_api functions `node_api_create_external_string_latin1` and `node_api_create_external_string_utf16` are now implemented

#### listen() in `node:http` callback bugfix

The error event was not emitting to the event listener correctly. Thanks to [@SuperAuguste](https://github.com/SuperAuguste) for fixing this.

## Bugfixes

#### Crash in `request.json()` fixed

A crash that could occur when calling `request.json()` was fixed. It was caused by incorrect exception handling in native code.

#### `bun pm rm cache` now works

The `bun pm rm cache` command now deletes the cache directory. Thanks to [@WingLim](https://github.com/WingLim).

#### Max redirect URL length is now 8192 instead of 4096

This fixes an issue with certain private npm registries.

#### bunx choosing version from $PATH instead of @version tag bugfix

A bug causing `bunx` to choose the version of the executable from `$PATH` instead of the `@version` tag was fixed

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">in the next version of bun<br><br>bunx foo@tag will always load the @tag version when a @tag is present, instead of choosing the version in <a href="https://twitter.com/search?q=%24PATH&amp;src=ctag&amp;ref_src=twsrc%5Etfw">$PATH</a> <a href="https://t.co/eCMVa0gSxF">pic.twitter.com/eCMVa0gSxF</a></p>&mdash; Jarred Sumner (@jarredsumner) <a href="https://twitter.com/jarredsumner/status/1704390982534594744?ref_src=twsrc%5Etfw">September 20, 2023</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

## Full changelog

{% table %}

---

- [`#4652`](https://github.com/oven-sh/bun/pull/4652)
- VSCode Extension Bunlock Syntax-Highlighting and Docs Improvements by [@JeremyFunk](JeremyFunk)

---

- [`#5451`](https://github.com/oven-sh/bun/pull/5451)
- docs(runtime): fix some typo. by [@zongzi531](zongzi531)

---

- [`#5531`](https://github.com/oven-sh/bun/pull/5531)
- Update development.md by [@sonyarianto](sonyarianto)

---

- [`#5525`](https://github.com/oven-sh/bun/pull/5525)
- fix(corking) uncork if needed by [@cirospaciari](cirospaciari)

---

- [`#5503`](https://github.com/oven-sh/bun/pull/5503)
- fix(request) handle undefined/null/empty signal on request by [@cirospaciari](cirospaciari)

---

- [`#5521`](https://github.com/oven-sh/bun/pull/5521)
- fix(bundler): Add a space before minified require by [@davidmhewitt](davidmhewitt)

---

- [`#5505`](https://github.com/oven-sh/bun/pull/5505)
- fix(node/fs.watch): Check first char before trimming event filenames by [@davidmhewitt](davidmhewitt)

---

- [`#5535`](https://github.com/oven-sh/bun/pull/5535)
- webkit upgrade by [@dylan-conway](dylan-conway)

---

- [`#5555`](https://github.com/oven-sh/bun/pull/5555)
- Follow-up for workspace docs #5379 and #5229 by [@bdenham](bdenham)

---

- [`#5579`](https://github.com/oven-sh/bun/pull/5579)
- fix: `ArrayBufferConstructor` type signature by [@52](52)

---

- [`#5580`](https://github.com/oven-sh/bun/pull/5580)
- fix: `array-buffer.test-d.ts` test by [@52](52)

---

- [`#4693`](https://github.com/oven-sh/bun/pull/4693)
- fix: node compatibility with empty path string (stat, exist, ...) by [@coratgerl](coratgerl)

---

- [`#5603`](https://github.com/oven-sh/bun/pull/5603)
- Make error message when importing a node: module in a browser bundle clearer by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5576`](https://github.com/oven-sh/bun/pull/5576)
- docs: fix typo in lockflie nav by [@Vilsol](Vilsol)

---

- [`#5593`](https://github.com/oven-sh/bun/pull/5593)
- Docs: path aliases fix by [@e253](e253)

---

- [`#5496`](https://github.com/oven-sh/bun/pull/5496)
- fix(fetch) handle 100 continue by [@cirospaciari](cirospaciari)

---

- [`#5387`](https://github.com/oven-sh/bun/pull/5387)
- feat(encoding): TextDecoder support undefined by [@WingLim](WingLim)

---

- [`#5481`](https://github.com/oven-sh/bun/pull/5481)
- fix(child_process) unref next tick so exit/close event can be fired before application exits by [@cirospaciari](cirospaciari)

---

- [`#5529`](https://github.com/oven-sh/bun/pull/5529)
- Implement VSCode tasks for bun by [@JeremyFunk](JeremyFunk)

---

- [`#5610`](https://github.com/oven-sh/bun/pull/5610)
- fix(install): Return NotSupported when errno == XDEV by [@pan93412](pan93412)

---

- [`#5510`](https://github.com/oven-sh/bun/pull/5510)
- Fix ZLS commit hash in the document by [@shinichy](shinichy)

---

- [`#5628`](https://github.com/oven-sh/bun/pull/5628)
- Added .DS_Store to gitignore-for-init by [@Cilooth](Cilooth)

---

- [`#5615`](https://github.com/oven-sh/bun/pull/5615)
- Workaround #5604 by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5626`](https://github.com/oven-sh/bun/pull/5626)
- Fix a TypeError in the documentation by [@LapsTimeOFF](LapsTimeOFF)

---

- [`#5656`](https://github.com/oven-sh/bun/pull/5656)
- Add a way to disable the GC timer by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5660`](https://github.com/oven-sh/bun/pull/5660)
- Remove hardcoded references to zig in Makefile by [@xbjfk](xbjfk)

---

- [`#5595`](https://github.com/oven-sh/bun/pull/5595)
- feat(console.log): Print anonymous when class name is unknown by [@JibranKalia](JibranKalia)

---

- [`#5572`](https://github.com/oven-sh/bun/pull/5572)
- feat(test): Implement `arrayContaining` by [@WingLim](WingLim)

---

- [`#5655`](https://github.com/oven-sh/bun/pull/5655)
- In `bun:sqlite`, make sure we set the number tag correctly when creating the JSValue by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5662`](https://github.com/oven-sh/bun/pull/5662)
- fix(config): support for registry url without trailing slash by [@Hanaasagi](Hanaasagi)

---

- [`#5685`](https://github.com/oven-sh/bun/pull/5685)
- fix(docs): update formatting by [@rauny-brandao](rauny-brandao)

---

- [`#5638`](https://github.com/oven-sh/bun/pull/5638)
- docs: add missing options from bun init by [@jumoog](jumoog)

---

- [`#5594`](https://github.com/oven-sh/bun/pull/5594)
- change circles for color-blinds by [@Hamcker](Hamcker)

---

- [`#5689`](https://github.com/oven-sh/bun/pull/5689)
- Fix HTTP listen behavior being non-compliant with node by [@paperclover](paperclover)

---

- [`#5448`](https://github.com/oven-sh/bun/pull/5448)
- feat(runtime): Implement `console.Console` by [@paperclover](paperclover)

---

- [`#5675`](https://github.com/oven-sh/bun/pull/5675)
- Implement `node_api_create_external_string_latin1` by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5699`](https://github.com/oven-sh/bun/pull/5699)
- fix(runtime/node): Allow `new Buffer.alloc()` + Upgrade WebKit by [@paperclover](paperclover)

---

- [`#5684`](https://github.com/oven-sh/bun/pull/5684)
- fix: remove unneeded branch in toJSONWithBytes by [@liz3](liz3)

---

- [`#5696`](https://github.com/oven-sh/bun/pull/5696)
- update llvm version from 15 to 16 in makefile by [@nithinkjoy-tech](nithinkjoy-tech)

---

- [`#5679`](https://github.com/oven-sh/bun/pull/5679)
- fix: provide empty string to 0 length process environment variables by [@liz3](liz3)

---

- [`#5025`](https://github.com/oven-sh/bun/pull/5025)
- `bun run` fix missing script error on empty file by [@Parzival-3141](Parzival-3141)

---

- [`#5444`](https://github.com/oven-sh/bun/pull/5444)
- Add navigator type definition by [@ruihe774](ruihe774)

---

- [`#5716`](https://github.com/oven-sh/bun/pull/5716)
- Encode slashes in package names in the registry manifest request by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5726`](https://github.com/oven-sh/bun/pull/5726)
- Make bun install --verbose more verbose by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5730`](https://github.com/oven-sh/bun/pull/5730)
- Fixes #3712 by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5729`](https://github.com/oven-sh/bun/pull/5729)
- Align fetch() redirect behavior with spec by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5744`](https://github.com/oven-sh/bun/pull/5744)
- Get artifactory to work by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5702`](https://github.com/oven-sh/bun/pull/5702)
- docs: Update Remix guide by [@brookslybrand](brookslybrand)

---

- [`#5620`](https://github.com/oven-sh/bun/pull/5620)
- Added react installation to react.md by [@jt3k](jt3k)

---

- [`#5597`](https://github.com/oven-sh/bun/pull/5597)
- remind users of the latest version by [@jumoog](jumoog)

---

- [`#5562`](https://github.com/oven-sh/bun/pull/5562)
- docs: update `net` node documentation by [@weyert](weyert)

---

- [`#5513`](https://github.com/oven-sh/bun/pull/5513)
- docs(development): typo which would lead to wrong llvm installation by [@sum117](sum117)

---

- [`#5759`](https://github.com/oven-sh/bun/pull/5759)
- Doc updates by [@colinhacks](colinhacks)

---

- [`#4571`](https://github.com/oven-sh/bun/pull/4571)
- fix(cli): `bun pm cache rm` command not work by [@WingLim](WingLim)

---

- [`#5762`](https://github.com/oven-sh/bun/pull/5762)
- fix(Makefile) by [@cirospaciari](cirospaciari)

---

- [`#5775`](https://github.com/oven-sh/bun/pull/5775)
- Fixes #5769 by [@Jarred-Sumner](Jarred-Sumner)

---

- [`#5447`](https://github.com/oven-sh/bun/pull/5447)
- add warning to Ensure correct placement of the '--watch' flag by [@a4addel](a4addel)

---

- [`#5456`](https://github.com/oven-sh/bun/pull/5456)
- Updated modules.md to address issue #5420 by [@h2210316651](h2210316651)

---

- [`#4810`](https://github.com/oven-sh/bun/pull/4810)
- docs: add Qwik guide by [@sanyamkamat](sanyamkamat)

---

{% /table %}

## New contributors

Thanks to Bun's newest contributors!

- @52 made their first contribution in https://github.com/oven-sh/bun/pull/5579
- @a4addel made their first contribution in https://github.com/oven-sh/bun/pull/5447
- @AaronDewes made their first contribution in https://github.com/oven-sh/bun/pull/4779
- @bdenham made their first contribution in https://github.com/oven-sh/bun/pull/5555
- @brookslybrand made their first contribution in https://github.com/oven-sh/bun/pull/5702
- @Brooooooklyn made their first contribution in https://github.com/oven-sh/bun/pull/5788
- @Cilooth made their first contribution in https://github.com/oven-sh/bun/pull/5628
- @coratgerl made their first contribution in https://github.com/oven-sh/bun/pull/4693
- @ggobbe made their first contribution in https://github.com/oven-sh/bun/pull/5786
- @h2210316651 made their first contribution in https://github.com/oven-sh/bun/pull/5456
- @Hamcker made their first contribution in https://github.com/oven-sh/bun/pull/5594
- @igorshapiro made their first contribution in https://github.com/oven-sh/bun/pull/5873
- @ImBIOS made their first contribution in https://github.com/oven-sh/bun/pull/5885
- @JeremyFunk made their first contribution in https://github.com/oven-sh/bun/pull/4652
- @JibranKalia made their first contribution in https://github.com/oven-sh/bun/pull/5595
- @jonahsnider made their first contribution in https://github.com/oven-sh/bun/pull/5104
- @jt3k made their first contribution in https://github.com/oven-sh/bun/pull/5620
- @jumoog made their first contribution in https://github.com/oven-sh/bun/pull/5638
- @liz3 made their first contribution in https://github.com/oven-sh/bun/pull/5684
- @nithinkjoy-tech made their first contribution in https://github.com/oven-sh/bun/pull/5696
- @pan93412 made their first contribution in https://github.com/oven-sh/bun/pull/5610
- @rauny-brandao made their first contribution in https://github.com/oven-sh/bun/pull/5685
- @ruihe774 made their first contribution in https://github.com/oven-sh/bun/pull/5444
- @sanyamkamat made their first contribution in https://github.com/oven-sh/bun/pull/4810
- @shinichy made their first contribution in https://github.com/oven-sh/bun/pull/5510
- @sum117 made their first contribution in https://github.com/oven-sh/bun/pull/5513
- @Vilsol made their first contribution in https://github.com/oven-sh/bun/pull/5576
- @weyert made their first contribution in https://github.com/oven-sh/bun/pull/5562
- @xbjfk made their first contribution in https://github.com/oven-sh/bun/pull/5660
- @yadav-saurabh made their first contribution in https://github.com/oven-sh/bun/pull/5270
