
Node To Bun
- 40 installs
- 4 repo stars
- Updated January 26, 2026
- daleseo/bun-skills
Migrates Node.js projects to Bun, auditing npm/pnpm/yarn dependencies for compatibility and flagging incompatible native modules.
About
Analyzes a Node project's dependencies and config, checks for incompatible native modules, and adapts it to Bun. Developers use it when converting an existing Node.js project to Bun.
- Flags problem packages (bcrypt, sharp, node-canvas) with alternatives
- Detects package manager and audits dependencies for Bun support
Node To Bun by the numbers
- 40 all-time installs (skills.sh)
- Ranked #3,286 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/daleseo/bun-skills --skill node-to-bunAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 40 |
|---|---|
| repo stars | ★ 4 |
| Last updated | January 26, 2026 |
| Repository | daleseo/bun-skills ↗ |
What it does
Migrates Node.js projects to Bun, auditing npm/pnpm/yarn dependencies for compatibility and flagging incompatible native modules.
Files
Node.js to Bun Migration
You are assisting with migrating an existing Node.js project to Bun. This involves analyzing dependencies, updating configurations, and ensuring compatibility.
Migration Workflow
1. Pre-Migration Analysis
Check if Bun is installed:
bun --versionAnalyze current project:
# Check Node.js version
node --version
# Check package manager
ls -la | grep -E "package-lock.json|yarn.lock|pnpm-lock.yaml"Read package.json to understand the project structure.
2. Dependency Compatibility Check
Read and analyze all dependencies from package.json:
cat package.jsonCheck for known incompatible native modules:
Common problematic packages (check against current dependencies):
bcrypt→ Usebcryptjsor@node-rs/bcryptinsteadsharp→ Bun has native support, but may need version checknode-canvas→ Limited support, check version compatibilitysqlite3→ Usebun:sqliteinsteadnode-gypdependent packages → May require alternative pure JS versionsfsevents→ macOS-specific, usually optional dependencyesbuild→ Bun has built-in bundler, may be redundant
Check workspace configuration (for monorepos):
# Check if workspaces are defined
grep -n "workspaces" package.json3. Generate Compatibility Report
Create a migration report file BUN_MIGRATION_REPORT.md:
# Bun Migration Analysis Report
## Project Overview
- **Name**: [project name]
- **Current Node Version**: [version]
- **Package Manager**: [npm/yarn/pnpm]
- **Project Type**: [app/library/monorepo]
## Dependency Analysis
### ✅ Compatible Dependencies
[List dependencies that are Bun-compatible]
### ⚠️ Potentially Incompatible Dependencies
[List dependencies that may have issues]
**Recommended Actions:**
- [Specific migration steps for each incompatible dependency]
### 🔄 Recommended Replacements
[List suggested package replacements]
## Configuration Changes Needed
### package.json
- [ ] Update scripts to use `bun` instead of `npm`/`yarn`
- [ ] Review and update `engines` field
- [ ] Check `type` field (ESM vs CommonJS)
### tsconfig.json
- [ ] Update `moduleResolution` to `"bundler"`
- [ ] Add `bun-types` to types array
- [ ] Set `allowImportingTsExtensions` to `true`
### Build Configuration
- [ ] Review webpack/rollup/esbuild config (may use Bun bundler)
- [ ] Update test runner config (use Bun test instead of Jest)
## Migration Steps
1. Install Bun dependencies
2. Update configuration files
3. Run tests to verify compatibility
4. Update CI/CD pipelines
5. Update documentation
## Risk Assessment
**Low Risk:**
[List low-risk changes]
**Medium Risk:**
[List items needing testing]
**High Risk:**
[List critical compatibility concerns]4. Backup Current State
Before making changes:
# Create backup branch if in git repo
git branch -c backup-before-bun-migration
# Or suggest user commits current state
git add -A
git commit -m "Backup before Bun migration"5. Update package.json
Read current package.json:
// Read and parse package.jsonUpdate scripts to use Bun:
{
"scripts": {
"dev": "bun run --hot src/index.ts",
"start": "bun run src/index.ts",
"build": "bun build src/index.ts --outdir=dist",
"test": "bun test",
"typecheck": "bun run --bun tsc --noEmit",
"lint": "bun run --bun eslint ."
}
}Update engines field:
{
"engines": {
"bun": ">=1.0.0"
}
}For libraries, add exports field if not present:
{
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}
}6. Update tsconfig.json
Read current tsconfig:
cat tsconfig.jsonApply Bun-specific updates:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"],
"lib": ["ES2022"],
"jsx": "react-jsx",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"noEmit": true
}
}Key changes explained:
moduleResolution: "bundler"→ Uses Bun's module resolutiontypes: ["bun-types"]→ Adds Bun's TypeScript definitionsallowImportingTsExtensions: true→ Allows importing.tsfiles directlynoEmit: true→ Bun runs TypeScript directly, no compilation needed
7. Handle Workspace Configuration
For monorepos with workspaces:
Verify workspace configuration is compatible:
{
"workspaces": [
"packages/*",
"apps/*"
]
}Bun supports the same workspace syntax as npm/yarn/pnpm.
Check workspace dependencies:
# Verify workspace structure
find . -name "package.json" -not -path "*/node_modules/*"8. Install Dependencies with Bun
Remove old lockfiles:
rm -f package-lock.json yarn.lock pnpm-lock.yamlInstall with Bun:
bun installThis creates bun.lockb (Bun's binary lockfile).
For workspaces:
bun install --frozen-lockfile # Equivalent to npm ci9. Update Test Configuration
If using Jest, migrate to Bun test:
Create bunfig.toml for test configuration:
[test]
preload = ["./tests/setup.ts"]
coverage = true
coverageThreshold = 0.8Update test files:
- Replace
import { test, expect } from '@jest/globals' - With
import { test, expect } from 'bun:test'
Jest compatibility notes:
- Most Jest APIs work out of the box
jest.mock()→ Usemock()frombun:test- Snapshot testing works the same
- Coverage reports may differ slightly
10. Update Environment Configuration
Check .env files:
ls -la | grep .envBun loads .env files automatically (same as dotenv package).
Update environment loading code:
- Remove
require('dotenv').config() - Bun loads
.envby default
11. Update Build Configuration
If using webpack/rollup/esbuild:
Consider replacing with Bun's built-in bundler:
// bun-build.ts
await Bun.build({
entrypoints: ['./src/index.ts'],
outdir: './dist',
minify: true,
splitting: true,
sourcemap: 'external',
target: 'bun',
});Update build script in package.json:
{
"scripts": {
"build": "bun run bun-build.ts"
}
}12. Update CI/CD Configuration
GitHub Actions example:
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run tests
run: bun test
- name: Type check
run: bun run typecheck
- name: Build
run: bun run build13. Verification Steps
Run these commands to verify migration:
# 1. Check dependencies installed correctly
bun install
# 2. Run type checking
bun run --bun tsc --noEmit
# 3. Run tests
bun test
# 4. Try development server
bun run dev
# 5. Test production build
bun run build14. Update Documentation
Create or update these documentation sections:
README.md:
## Prerequisites
- [Bun](https://bun.sh) 1.0 or higher
## Installation
bun install
## Development
bun run dev
## Testing
bun test
CHANGELOG.md entry:
## [Version] - [Date]
### Changed
- Migrated from Node.js/npm to Bun
- Updated all dependencies to Bun-compatible versions
- Replaced [specific packages] with [alternatives]
- Updated TypeScript configuration for BunCommon Migration Issues & Solutions
Issue: Native Module Incompatibility
Symptoms:
error: Cannot find module "bcrypt"Solution:
# Replace with pure JavaScript alternative
bun remove bcrypt
bun add bcryptjs
# Update imports
# Before: import bcrypt from 'bcrypt';
# After: import bcrypt from 'bcryptjs';Issue: ESM/CommonJS Conflicts
Symptoms:
error: require() of ES Module not supportedSolution:
Add to package.json:
{
"type": "module"
}Or use .mts extension for ES modules and .cts for CommonJS.
Issue: Path Alias Resolution
Symptoms:
error: Cannot resolve "@/components"Solution:
Verify tsconfig.json paths match:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}Bun respects TypeScript path aliases automatically.
Issue: Test Failures
Symptoms:
error: jest is not definedSolution:
Update test imports:
// Before
import { describe, it, expect } from '@jest/globals';
// After
import { describe, it, expect } from 'bun:test';Migration Checklist
Present this checklist to the user:
- [ ] Bun installed and verified
- [ ] Dependency compatibility analyzed
- [ ] Migration report reviewed
- [ ] Current state backed up (git commit/branch)
- [ ]
package.jsonscripts updated - [ ]
tsconfig.jsonconfigured for Bun - [ ] Old lockfiles removed
- [ ] Dependencies installed with
bun install - [ ] Test configuration migrated
- [ ] Tests passing with
bun test - [ ] Build process verified
- [ ] CI/CD updated for Bun
- [ ] Documentation updated
- [ ] Team notified of migration
Post-Migration Performance Verification
After migration, help user verify performance improvements:
# Compare install times
time bun install # Should be 3-10x faster than npm
# Compare test execution
time bun test # Should be faster than Jest
# Compare startup time
time bun run src/index.ts # Should be 90% faster than ts-nodeRollback Procedure
If migration encounters critical issues:
# Return to backup branch
git checkout backup-before-bun-migration
# Or restore original state
git reset --hard HEAD~1
# Reinstall original dependencies
npm install # or yarn/pnpmCompletion
Once migration is complete, provide summary:
- ✅ Migration status (success/partial/issues)
- ✅ List of changes made
- ✅ Performance improvements observed
- ✅ Any remaining manual steps
- ✅ Links to Bun documentation for ongoing development
Bun Compatibility Matrix
This document tracks known compatibility issues and recommended alternatives for common Node.js packages when migrating to Bun.
Native Modules
❌ Incompatible or Problematic
| Package | Issue | Alternative | Notes |
|---|---|---|---|
bcrypt | Native binding issues | bcryptjs, @node-rs/bcrypt | bcryptjs is pure JS (slower), @node-rs/bcrypt uses Rust |
node-canvas | Cairo dependencies | skia-canvas, Server-side rendering alternatives | Limited Bun support |
node-gyp | Build tooling | Find pure JS alternatives | Any package requiring node-gyp may have issues |
fsevents | macOS-specific native | Usually optional | Often works as optional dependency |
sqlite3 | Native bindings | bun:sqlite (built-in) | Bun has native SQLite support |
better-sqlite3 | Native bindings | bun:sqlite | Use Bun's built-in SQLite |
node-sass | LibSass deprecated | sass (Dart Sass) | Dart Sass works with Bun |
grpc | Native bindings | @grpc/grpc-js | Pure JavaScript gRPC implementation |
✅ Compatible with Caveats
| Package | Status | Notes |
|---|---|---|
sharp | ✅ Works | May need specific version, test thoroughly |
puppeteer | ✅ Works | Use with bunx or install Chromium separately |
playwright | ✅ Works | Browser automation works well |
prisma | ✅ Works | ORM works, may need bunx prisma generate |
esbuild | ⚠️ May be redundant | Bun has built-in bundler |
Test Frameworks
| Package | Status | Migration Path |
|---|---|---|
jest | ⚠️ Replace | Use bun:test (Jest-compatible API) |
vitest | ⚠️ Replace | Use bun:test |
mocha | ⚠️ Replace | Use bun:test with describe/it API |
ava | ⚠️ Replace | Use bun:test |
tap | ⚠️ Replace | Use bun:test |
Migration example:
// Before (Jest)
import { describe, it, expect } from '@jest/globals';
// After (Bun)
import { describe, it, expect } from 'bun:test';Build Tools
| Package | Status | Alternative |
|---|---|---|
webpack | ⚠️ May not need | Bun.build() |
rollup | ⚠️ May not need | Bun.build() |
esbuild | ⚠️ May not need | Bun.build() |
parcel | ⚠️ May not need | Bun.build() |
vite | ✅ Works | But consider Bun.build() for simpler setups |
tsup | ⚠️ May not need | Bun.build() |
TypeScript Tooling
| Package | Status | Notes |
|---|---|---|
ts-node | ⚠️ Not needed | Bun runs TypeScript natively |
tsx | ⚠️ Not needed | Bun runs TypeScript natively |
ts-node-dev | ⚠️ Not needed | Use bun --hot |
nodemon | ⚠️ Not needed | Use bun --watch or bun --hot |
typescript | ✅ Keep | Still needed for type checking |
@types/* | ✅ Keep | Type definitions still useful |
Development Tools
| Package | Status | Alternative |
|---|---|---|
dotenv | ⚠️ Not needed | Bun loads .env automatically |
cross-env | ⚠️ Not needed | Bun handles env vars cross-platform |
concurrently | ✅ Works | Or use Bun scripts |
npm-run-all | ⚠️ May not need | Use Bun scripts or shell |
Web Frameworks
| Package | Status | Notes |
|---|---|---|
express | ✅ Works | Fully compatible |
fastify | ✅ Works | Performance benefits with Bun |
hono | ✅ Recommended | Designed for edge runtimes, works great with Bun |
koa | ✅ Works | Compatible |
next.js | ⚠️ Experimental | Bun support is experimental |
nest.js | ✅ Works | Compatible, may need configuration |
remix | ⚠️ Experimental | Check latest compatibility |
Database Clients
| Package | Status | Notes |
|---|---|---|
pg (PostgreSQL) | ✅ Works | Pure JS client works well |
mysql2 | ✅ Works | Compatible |
mongodb | ✅ Works | Native driver works |
redis | ✅ Works | ioredis and node-redis both work |
prisma | ✅ Works | ORM works, run bunx prisma generate |
drizzle-orm | ✅ Works | Excellent Bun support |
typeorm | ✅ Works | Compatible |
sequelize | ✅ Works | Compatible |
knex | ✅ Works | Query builder works |
Utility Libraries
| Package | Status | Notes |
|---|---|---|
lodash | ✅ Works | Fully compatible |
axios | ✅ Works | But consider native fetch API |
node-fetch | ⚠️ Not needed | Bun has native fetch |
got | ✅ Works | HTTP client works |
date-fns | ✅ Works | Fully compatible |
dayjs | ✅ Works | Fully compatible |
uuid | ✅ Works | Works, or use crypto.randomUUID() |
nanoid | ✅ Works | Fully compatible |
zod | ✅ Works | Schema validation works perfectly |
joi | ✅ Works | Compatible |
yup | ✅ Works | Compatible |
Frontend Libraries
| Package | Status | Notes |
|---|---|---|
react | ✅ Works | Full support with JSX transform |
react-dom | ✅ Works | Compatible |
vue | ✅ Works | Compatible |
svelte | ✅ Works | Compatible |
preact | ✅ Works | Excellent support |
solid-js | ✅ Works | Compatible |
Package Managers
| Tool | Status | Notes |
|---|---|---|
npm | ⚠️ Replace | Use bun install |
yarn | ⚠️ Replace | Use bun install |
pnpm | ⚠️ Replace | Use bun install |
Version-Specific Issues
Bun 1.0.x
- Native modules may require specific versions
- Some packages with C++ bindings need testing
- Binary packages may need platform-specific builds
Known Good Versions
Track working versions of problematic packages:
{
"dependencies": {
"sharp": "^0.32.0",
"@node-rs/bcrypt": "^1.9.0"
}
}Testing Compatibility
When encountering unknown packages, test with:
# Install and test
bun add <package-name>
bun run --eval "import pkg from '<package-name>'; console.log(pkg)"
# Run package's own tests if available
bun testReporting Issues
If you find incompatible packages:
1. Check Bun's GitHub issues 2. Test with latest Bun version 3. Report with minimal reproduction 4. Include package version and Bun version