August 5, 2026

Introducing bun, a new package manager and JavaScript runtime environment

New job? New toolset to explore! In this post I'll be investigating a new JavaScript package manager and runtime environment called bun.sh

You may have noticed on Playwright.Dev's Getting Started / Installation section there are three different ways to install a ui or api test automation framework the latest version of Playwright:
  • npm init playwright@latest
  • yarn create playwright
  • pnpm create playwright
For this blog post I'll be investigating a fourth way, the new toolset they just started using at work, bun.sh.
  • bun create playwright
When putting together a Playwright automation framework based around JavaScript and TypeScript, Playwright uses the Node.js JavaScript runtime environment, to run its test runner, execute automation scripts, and manage its browser instances.(See Nodejs.org / About )

There is a division of labor: Node.js runs Playwright's internal functions. NPM, Yarn, PNMP, and now Bun handle the packages. 

Each package manager has its own specialization. NPM is bundled already with Node.js. Yarn is a Facebook toolset that started downloading packages in parallel. PNPM has a smaller footprint. And bun is built for quick startup and installation speed, good especially if you have a CI/ CD pipeline that has a LOT of packages to install each time the tests run.

What is a package? Developing a project, you don't have to figure out how to code everything yourself. You can include in your projects outside libraries, or "packages" of code from from the public JavaScript registry npmjs.com

The problem is that these packages then need to be downloaded, installed, managed, and updated whenever there are changes. JavaScript projects can use a package manager, such as bun, to help this process. 


NPM, released in 2010, is the Node Package Manager for Node.js, a JavaScript Runtime Environment. According to NodeJS.org's An introduction to the npm package manager, "The npm installs, updates and manages downloads of dependencies of your project. Dependencies are pre-built pieces of code, such as libraries and packages, that your Node.js application needs to work". NPM comes with NPX (Node Package eXecute) is a command-line tool that runs third-party code, known as packages or dependencies, such as Playwright.

Yarn https://yarnpkg.com/, released in 2016, is Facebook's answer to NPM. Facebook needed a lot of JavaScript packages downloaded at the same time. NPM downloaded them only sequentially, one after another, causing it to be very slow the bigger the project became. According to the Engineering at Meta blog article Yarn: A new package manager for JavaScript, "As the size of [Facebook's] codebase and the number of engineers grew, we ran into problems with consistency, security, and performance".  

Pnpm (Performant npm) is another JavaScript package manager, released in 2017. It uses symbolic links to organize the node_modules, increasing performance by decreasing the number of files needed.

Bun https://bun.sh released in 2021 and purchased by Anthropic in 2025, isn't just a package manager like NPM. It is a JavaScript runtime environment like Node.js. 

There are many similarities between these package managers:
  • Package Registry: All tools fetch packages from the official npmjs.com site.
  • Manifest File: They all rely on package.json to read and write project dependencies and scripts. They show the name, version, package manager, license, and more (See NPM Docs / Package.json or  Yarn Package / Manifest )
  • Dependency Folders: Each tool downloads packages into a local node_modules folder inside your project directory. 
  • Lockfiles: They use lockfiles to ensure reproducible builds across different environments, such as package-lock.json. (See NPM Docs / package-lock.json)

The big difference is that Bun isn't just a package manager: It's a completely new JavaScript runtime environment created to replace Node. 

NPM, Yarn, and PNMP are all built on top of Node.js. Bun is built using an entirely new language interacting with Apple's JavaScriptCore engine, developed by Apple for Safari.  

NPM with V8 vs Apple's JavaScriptCore

NPM is built with V8 and Bun is built on JavaScriptCore... But what is V8 and JavaScriptCore? 

According to the Codeverse Chronicle article, JavaScriptCore vs V8 Engine, "JavaScriptCore [...] , is the JavaScript engine developed by Apple. It powers the JavaScript execution within Apple's Safari browser and is also utilized in various macOS and iOS applications. JavaScriptCore is an open-source project, making its codebase accessible to developers and allowing for contributions from the community.

"JavaScriptCore is deeply integrated into the Apple ecosystem, which means it's optimized for Safari and other Apple products. This tight integration ensures excellent performance and compatibility within the Apple ecosystem.

"V8 Engine is developed by Google and is widely known for powering the Chrome browser. It's also used in other projects like Node.js and various server-side applications".

About Bun

Attempting to construct a Minecraft-like game, Jarred Sumner found Next.js painfully slow when trying to save and test his work. Bun initially interacted with the JavaScriptCore engine using the Zig programming language, but converted it to the Rust programming language in 2026. 
According to the GitHub README for Bun, "At its core is the Bun runtime, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Rust and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.

"The bun command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. Instead of 1,000 node_modules for development, you only need bun. Bun's built-in tools are significantly faster than existing options and usable in existing Node.js projects with little to no changes".

How to Install Bun


According to the GitHub README for Bun, you can install Bun on your MacBook using HomeBrew, with Curl, with NPM, or pulling down an image from Docker. 

On Windows, you can use PowerShell. Since I use a Windows PC at home, I'll install it that way:
  • powershell -c "irm bun.sh/install.ps1 | iex"
Restarting my PowerShell Terminal, checking that bun was installed correctly:
  • bun -version
... And it replied I am using version 1.3.14. 

In the next blog post, we will figure out how to use bun to create a Playwright framework. 


Happy Testing!

-T.J. Maher
Software Engineer in Test

BlueSky | YouTubeLinkedIn | Articles

No comments:

Post a Comment