Bun "node:" Module Compatibility Errors in CI
Bun aims for Node compatibility but does not implement every node: built-in API or native binding. Code that runs under Node can fail under Bun when it hits an unimplemented API or a native addon Bun cannot load.
What this error means
Under bun run, code fails with "not implemented" for a node: API (or a method on one), or a native addon fails to load. The same code works under Node, which points at a Bun compatibility gap.
error: "node:v8".serialize is not implemented in Bun yet.
# or
error: Cannot load native addon "node_modules/.../binding.node" under BunCommon causes
Unimplemented Node built-in API
A specific node: module or method is not yet implemented in Bun, so calling it throws at runtime.
Native addon Bun cannot load
A dependency relying on a native .node binding built for Node’s ABI may not load under Bun.
How to fix it
Use a Bun-native or portable alternative
Replace the unsupported API/addon with a Bun-native API or a pure-JS library.
// instead of an unsupported node: API or native addon:
import { Database } from "bun:sqlite"; // Bun-native SQLite
// or choose a pure-JS dependency with no native bindingRun that workload under Node
- Check Bun’s Node-compatibility status for the specific API you use.
- If a critical dependency needs an unimplemented API or native addon, run that job under Node instead of Bun.
- Pin the Bun version and re-test as compatibility improves across releases.
How to prevent it
- Verify
node:API and native-addon support in Bun before adopting a dependency. - Prefer Bun-native or pure-JS libraries for Bun-run workloads.
- Pin the Bun version so compatibility behavior is stable.