I switched to Bun for the speed boost and immediately hit a wall. bun install
kept throwing "incorrect peer dependency" warnings that made zero sense. Everything seemed to install fine, but then ESLint would break with cryptic errors like EREQUIRE_ESM
or my TypeScript config would just... not work.
The Real Problem (Not the Academic Bullshit)
Here's what actually happens: npm is conservative as hell when picking versions. If package A wants eslint@8
and package B is okay with eslint@8 || eslint@9
, npm goes with ESLint 8 because it satisfies everyone without breaking shit.
Bun says "fuck it, let's go with the latest" and installs ESLint 9. Then it spams you with warnings because half your packages were expecting ESLint 8 and now they're pissed off.
This GitHub issue was opened December 2024 and already has 3 reactions from developers hitting the same wall. The issue shows exact examples of ESLint version conflicts with @typescript-eslint/utils@8.18.0
expecting ^8.57.0 || ^9.0.0
but Bun choosing v9 anyway. The Bun team assigned it but fixing requires rewriting their entire dependency resolver.
What You'll Actually See
Here's the pain you'll experience:
The Error Spam: After bun install
, your terminal gets flooded with:
warn: incorrect peer dependency \"eslint@9.16.0\"
warn: incorrect peer dependency \"eslint@9.16.0\"
warn: incorrect peer dependency \"eslint@9.16.0\"
Then Your Linter Dies: You run bunx eslint src/
and get:
Error [ERR_REQUIRE_ESM]: require() of ES module not supported
This ERR_REQUIRE_ESM error happens when ESLint 9's ESM-first approach conflicts with packages expecting CommonJS.
Or TypeScript Gets Confused: Your `@typescript-eslint` rules just... don't work. No obvious error, they're just ignored.
My 3-Hour Debugging Session
I spent an entire afternoon trying to figure out why ESLint worked fine with npm but broke with Bun. Same fucking project, same package.json. Made no sense.
The smoking gun was comparing dependency trees:
npm install
npm ls eslint
## eslint@8.57.0
rm -rf node_modules package-lock.json
bun install
bun pm ls | grep eslint
## eslint@9.16.0
Bun picked a different ESLint version even though my package.json said \"eslint\": \"^8.57.0\"
. Why? Because some buried dependency had eslint@^8.0.0 || ^9.0.0
in their peer deps and Bun just decided "fuck it, 9 is newer" without asking me.
Platform-Specific Gotchas
Windows: The Windows PATH limit will fuck you. Bun's `node_modules` structure is different and some Windows setups can't handle the longer paths. You'll get `ENAMETOOLONG` errors.
Node 18.2.0: There's a specific Node version that breaks Bun's ESLint integration. Upgrade to 18.3.0+ or downgrade to 18.1.x.
M1 Macs: Some native dependencies get confused about architectures when Bun resolves different versions than npm. Especially `@esbuild/` packages.
I wasted hours trying theoretical solutions before finding what actually works. The fixes below are battle-tested - I use them daily on production apps.