Currently viewing the AI version
Switch to human version

Bun Peer Dependency Resolution Issues: Technical Reference

Root Cause Analysis

Core Problem: Bun's dependency resolver prioritizes latest versions over compatibility, causing peer dependency conflicts with ESLint and TypeScript tooling.

Specific Behavior Difference:

  • npm: Conservative resolution - selects oldest compatible version (e.g., ESLint 8.57.0)
  • Bun: Aggressive resolution - selects newest compatible version (e.g., ESLint 9.16.0)

Impact Severity: High - breaks linting and TypeScript configurations in production environments

Failure Modes and Symptoms

Critical Errors

  1. EREQUIRE_ESM Error

    • Cause: ESLint 9's ESM-first approach conflicts with CommonJS-expecting packages
    • Trigger: Running bunx eslint src/
    • Impact: Complete linting failure
  2. Silent TypeScript Rule Failures

    • Cause: Version mismatch between ESLint and @typescript-eslint packages
    • Symptom: Rules ignored without error messages
    • Detection: Rules not enforced despite configuration
  3. Warning Spam

    • Output: Hundreds of "incorrect peer dependency" warnings
    • Impact: Obscures actual issues, creates noise in CI/CD

Platform-Specific Issues

  • Windows: ENAMETOOLONG errors due to longer node_modules paths
  • Node 18.2.0: Specific version breaks Bun's ESLint integration
  • M1 Macs: Native dependency architecture conflicts with @esbuild packages

Proven Solutions

1. Version Forcing (Primary Fix)

Implementation Time: 30 seconds
Success Rate: 95% of cases

{
  "resolutions": {
    "eslint": "8.57.0",
    "@typescript-eslint/eslint-plugin": "7.18.0",
    "@typescript-eslint/parser": "7.18.0"
  }
}

Recovery Process:

rm -rf node_modules bun.lockb package-lock.json
bun install

2. Exact Version Pinning (Prevention)

When: Start of new projects
Maintenance Overhead: Minimal - prevents future issues

{
  "devDependencies": {
    "eslint": "8.57.0",
    "@typescript-eslint/eslint-plugin": "7.18.0"
  }
}

3. Hybrid Approach (High Reliability)

Use Case: Complex projects with 100+ dependencies
Performance Trade-off: Slower installs, faster everything else

npm install      # Installation with npm
bun run dev      # Execution with Bun
bun run build
bun test

4. Configuration Override (Last Resort)

bunfig.toml:

[install]
exact = true
peer = false

Warning: Unstable across Bun versions (broken in v1.2.x updates)

Tested Version Matrix

Framework ESLint TypeScript @typescript-eslint/* Status (Bun 1.2.21)
React 18 8.57.0 5.5.4 7.18.0 ✅ Stable
Next.js 14 8.57.0 5.5.4 7.18.0 ⚠️ Watch eslint-config-next
Vite 8.57.0 5.5.4 7.18.0 ✅ No issues
Turborepo 8.57.0 5.5.4 7.18.0 ⚠️ Workspace deps buggy

Framework-Specific Gotchas

Next.js 14

  • Breaking Point: eslint-config-next incompatible with ESLint 9
  • Required Resolution: Force ESLint 8.57.0
  • Config: "eslint-config-next": "14.2.5"

Vite Projects

  • Issue: @vitejs/plugin-react peer dependency conflicts
  • Solution: Same version pinning approach

Diagnostic Commands

Immediate Issue Detection

bun pm ls | grep eslint          # Check installed ESLint version
bunx eslint --version            # Verify executable version
bunx eslint src/                 # Test functionality

Pre-Installation Validation

#!/bin/bash
rm -rf node_modules bun.lockb
bun install 2>&1 | tee /tmp/install.log
if grep -q "incorrect peer dependency" /tmp/install.log; then
    echo "💩 Dependency conflicts found"
    exit 1
fi

Resource Requirements

Time Investment

  • Initial Setup: 30 seconds (version forcing)
  • Project Start: 5 minutes (proper pinning)
  • Debugging Without Guide: 2-3 hours average
  • Recovery Time: 30 seconds with known solution

Expertise Requirements

  • Minimum: Basic package.json understanding
  • Preferred: npm/yarn resolution mechanism knowledge
  • Team Training: Document working versions, establish update protocols

Decision Criteria

Stay with Bun When:

  • Simple projects (<50 dependencies)
  • Can implement version forcing in 5 minutes
  • Speed boost outweighs occasional debugging

Switch to npm When:

  • Complex dependency chains (100+ packages)
  • Production applications requiring stability
  • Team environment with multiple developers
  • Frequent breaking changes consuming development time

Critical Warnings

  1. Never ignore major version peer dependency mismatches - leads to silent failures
  2. Bun 1.2.x broke bunfig.toml configurations - test thoroughly before relying on config overrides
  3. ESLint 9 + TypeScript ESLint compatibility still unstable as of August 2025
  4. Windows PATH limits can cause ENAMETOOLONG errors with Bun's node_modules structure

Emergency Fallback

{
  "scripts": {
    "install:bun": "bun install",
    "install:npm": "npm install",
    "deps:check": "./check-deps.sh"
  }
}

When Bun updates break existing projects, immediate fallback to npm install prevents project downtime.

Status Tracking

  • GitHub Issue: #15711 (December 2024)
  • Resolution Timeline: Requires rewriting Bun's dependency resolver
  • Workaround Stability: High for version forcing, unstable for config overrides

Useful Links for Further Investigation

Links That Actually Help (Not Just Documentation Fluff)

LinkDescription
Bun Issue #15711The main thread where everyone's bitching about broken peer dependency resolution. Read the comments, not just the issue description. Real solutions are buried in there.
Fixing conflicting peer dependenciesMost answers are bullshit, but sort by votes and look for the ones that actually show `resolutions` examples.
How to handle conflicting peer dependenciesMain SO thread with multiple solutions for ESLint and other peer dependency conflicts.
npm-check-updatesShows you which packages have updates, but for the love of God DON'T auto-update everything with Bun. Use it to see what's available, then update one at a time like a sane person.
Yarn resolutions docsBun borrowed this feature from Yarn. The syntax is the same.
npm overrides docsDifferent syntax but same concept. Stick with `resolutions` for Bun.
npm docsFor when you're tired of fighting with Bun and just want shit to work.

Related Tools & Recommendations

howto
Recommended

Migrate from Webpack to Vite Without Breaking Everything

Your webpack dev server is probably slower than your browser startup

Webpack
/howto/migrate-webpack-to-vite/complete-migration-guide
100%
integration
Recommended

GitHub Actions + Docker + ECS: Stop SSH-ing Into Servers Like It's 2015

Deploy your app without losing your mind or your weekend

GitHub Actions
/integration/github-actions-docker-aws-ecs/ci-cd-pipeline-automation
94%
review
Recommended

Which JavaScript Runtime Won't Make You Hate Your Life

Two years of runtime fuckery later, here's the truth nobody tells you

Bun
/review/bun-nodejs-deno-comparison/production-readiness-assessment
87%
alternatives
Recommended

Your Monorepo Builds Take 20 Minutes Because Yarn Workspaces Is Broken

Tools that won't make you want to quit programming

Yarn Workspaces
/alternatives/yarn-workspaces/modern-monorepo-alternatives
62%
tool
Recommended

Yarn Workspaces - Monorepo Setup That Actually Works

Stop wrestling with multiple package.json files and start getting shit done.

Yarn Workspaces
/tool/yarn-workspaces/monorepo-setup-guide
62%
troubleshoot
Recommended

Fix Yarn Corepack "packageManager" Version Conflicts

Stop Yarn and Corepack from screwing each other over

Yarn Package Manager
/tool/troubleshoot/yarn-package-manager-error-troubleshooting/corepack-version-conflicts
62%
tool
Recommended

pnpm - Fixes npm's Biggest Annoyances

competes with pnpm

pnpm
/tool/pnpm/overview
59%
alternatives
Recommended

Webpack is Slow as Hell - Here Are the Tools That Actually Work

Tired of waiting 30+ seconds for hot reload? These build tools cut Webpack's bloated compile times down to milliseconds

Webpack
/alternatives/webpack/modern-performance-alternatives
58%
tool
Recommended

Webpack Performance Optimization - Fix Slow Builds and Giant Bundles

integrates with Webpack

Webpack
/tool/webpack/performance-optimization
58%
tool
Recommended

GitHub Actions Marketplace - Where CI/CD Actually Gets Easier

integrates with GitHub Actions Marketplace

GitHub Actions Marketplace
/tool/github-actions-marketplace/overview
58%
alternatives
Recommended

GitHub Actions Alternatives That Don't Suck

integrates with GitHub Actions

GitHub Actions
/alternatives/github-actions/use-case-driven-selection
58%
compare
Recommended

Bun vs Deno vs Node.js: Which Runtime Won't Ruin Your Weekend?

A Developer's Guide to Not Hating Your JavaScript Toolchain

Bun
/compare/bun/node.js/deno/ecosystem-tooling-comparison
56%
tool
Recommended

Bun - Node.js Without the 45-Minute Install Times

JavaScript runtime that doesn't make you want to throw your laptop

Bun
/tool/bun/overview
56%
howto
Recommended

Migrating CRA Tests from Jest to Vitest

integrates with Create React App

Create React App
/howto/migrate-cra-to-vite-nextjs-remix/testing-migration-guide
56%
integration
Recommended

Vite + React 19 + TypeScript + ESLint 9: Actually Fast Development (When It Works)

Skip the 30-second Webpack wait times - This setup boots in about a second

Vite
/integration/vite-react-typescript-eslint/integration-overview
56%
alternatives
Recommended

Docker Alternatives That Won't Break Your Budget

Docker got expensive as hell. Here's how to escape without breaking everything.

Docker
/alternatives/docker/budget-friendly-alternatives
56%
integration
Recommended

GitOps Integration Hell: Docker + Kubernetes + ArgoCD + Prometheus

How to Wire Together the Modern DevOps Stack Without Losing Your Sanity

docker
/integration/docker-kubernetes-argocd-prometheus/gitops-workflow-integration
56%
compare
Recommended

I Tested 5 Container Security Scanners in CI/CD - Here's What Actually Works

Trivy, Docker Scout, Snyk Container, Grype, and Clair - which one won't make you want to quit DevOps

docker
/compare/docker-security/cicd-integration/docker-security-cicd-integration
56%
howto
Recommended

Install Node.js with NVM on Mac M1/M2/M3 - Because Life's Too Short for Version Hell

My M1 Mac setup broke at 2am before a deployment. Here's how I fixed it so you don't have to suffer.

Node Version Manager (NVM)
/howto/install-nodejs-nvm-mac-m1/complete-installation-guide
56%
tool
Recommended

Parcel - Fucking Finally, A Build Tool That Doesn't Hate You

The build tool that actually works without making you want to throw your laptop out the window

Parcel
/tool/parcel/overview
53%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization