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 with 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

What is npm, yarn, pnpm, and bun? These are called package managers.

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 they are updated. JavaScript projects can use a package manager, such as bun, to help this process. 

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 these internal functions like running tests. NPM, Yarn, PNPM, and now Bun handle the packages. 

Why are there so many package managers? Each has its own specialization. The original NPM is bundled already with Node.js. Yarn is a Facebook toolset that was created when NPM was found to work too slow. PNPM was created to be smaller and therefore faster. And bun was 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.



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 that was built to replace Node.js. 

In spite of the differences, 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)

There is also one main difference between the others and bun. 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.

"[The] 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".

There is one more thing about Bun... it was purchased by Anthropic to be used in Claude Code. 

From the press release, Anthropic acquires Bun as Claude Code reaches $1B milestone:

"Bun is redefining speed and performance for modern software engineering and development. Founded by Jarred Sumner in 2021, Bun is dramatically faster than the leading competition. As an all-in-one toolkit—combining runtime, package manager, bundler, and test runner—it's become essential infrastructure for AI-led software engineering, helping developers build and test applications at unprecedented velocity.

"Bun has improved the JavaScript and TypeScript developer experience by optimizing for reliability, speed, and delight. For those using Claude Code, this acquisition means faster performance, improved stability, and new capabilities. Together, we’ll keep making Bun the best JavaScript runtime for all developers, while building even better workflows into Claude Code.

"[...] Bun represents exactly the kind of technical excellence we want to bring into Anthropic," said Mike Krieger, Chief Product Officer of Anthropic. "Jarred and his team rethought the entire JavaScript toolchain from first principles while remaining focused on real use cases. Claude Code reached $1 billion in run-rate revenue in only 6 months, and bringing the Bun team into Anthropic means we can build the infrastructure to compound that momentum and keep pace with the exponential growth in AI adoption."

"As developers increasingly build with AI, the underlying infrastructure matters more than ever—and Bun has emerged as an essential tool. Bun gets more than 7 million monthly downloads, has earned over 82,000 stars on GitHub, and has been adopted by companies like Midjourney and Lovable to increase speed and productivity.

"The decision to acquire Bun is in line with our strategic, disciplined approach to acquisitions: we will continue to pursue opportunities that bolster our technical excellence, reinforce our strength as the leader in enterprise AI, and most importantly, align with our principles and mission". 

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. Wonderful! It's alive! It's .... alive! Had the installation not gone successfully, it would have errored out. 

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