nextjs - 💡(How to fix) Fix Cannot find babel-react-compiler when using Bun [26 comments, 18 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85234Fetched 2026-04-08 02:17:01
View on GitHub
Comments
26
Participants
18
Timeline
82
Reactions
27

Error Message

git clone https://github.com/Jayllyz/next-bun-react-compiler bun install bun run build

$ next build ▲ Next.js 16.0.1 (Turbopack)

  • Experiments (use with caution): · serverActions ✓ turbopackFileSystemCacheForDev

Creating an optimized production build ...

Build error occurred Error: Turbopack build failed with 1 errors: ./src/app/page.tsx Error evaluating Node.js code ResolveMessage: Cannot find module './node_modules/.bun/[email protected]/node_modules/babel-plugin-react-compiler' from '/Users/jayllyz/code/my-app/node_modules/.bun/[email protected]+f98dd74b6b4c2783/node_modules/next/dist/compiled/babel/bundle.js'

Make sure that all the Babel plugins and presets you are using are defined as dependencies or devDependencies in your package.json file. It's possible that the missing plugin is loaded by a preset you are using that forgot to add the plugin to its dependencies: you can workaround this problem by explicitly adding the missing package to your top-level package.json.

Import traces: Client Component Browser: ./src/app/page.tsx [Client Component Browser] ./src/app/page.tsx [Server Component]

Client Component SSR: ./src/app/page.tsx [Client Component SSR] ./src/app/page.tsx [Server Component]

at <unknown> (file. It's possible that the missing plugin is loaded by a preset)
at processTicksAndRejections (null)

error: script "build" exited with code 1

Fix Action

Fix / Workaround

Make sure that all the Babel plugins and presets you are using are defined as dependencies or devDependencies in your package.json file. It's possible that the missing plugin is loaded by a preset you are using that forgot to add the plugin to its dependencies: you can workaround this problem by explicitly adding the missing package to your top-level package.json.

Code Example

git clone https://github.com/Jayllyz/next-bun-react-compiler
bun install
bun run build

$ next build
Next.js 16.0.1 (Turbopack)
   - Experiments (use with caution):
     · serverActions
     ✓ turbopackFileSystemCacheForDev

   Creating an optimized production build ...

> Build error occurred
Error: Turbopack build failed with 1 errors:
./src/app/page.tsx
Error evaluating Node.js code
ResolveMessage: Cannot find module './node_modules/.bun/[email protected]/node_modules/babel-plugin-react-compiler' from '/Users/jayllyz/code/my-app/node_modules/.bun/[email protected]+f98dd74b6b4c2783/node_modules/next/dist/compiled/babel/bundle.js'

Make sure that all the Babel plugins and presets you are using
are defined as dependencies or devDependencies in your package.json
file. It's possible that the missing plugin is loaded by a preset
you are using that forgot to add the plugin to its dependencies: you
can workaround this problem by explicitly adding the missing package
to your top-level package.json.


Import traces:
  Client Component Browser:
    ./src/app/page.tsx [Client Component Browser]
    ./src/app/page.tsx [Server Component]

  Client Component SSR:
    ./src/app/page.tsx [Client Component SSR]
    ./src/app/page.tsx [Server Component]


    at <unknown> (file. It's possible that the missing plugin is loaded by a preset)
    at processTicksAndRejections (null)
error: script "build" exited with code 1

---

bun run build:webpack
$ next build --webpack
Next.js 16.0.1 (webpack)

   Creating an optimized production build ...
Compiled successfully in 3.6s
Finished TypeScript in 984.7ms
Collecting page data in 227.0ms
Generating static pages (4/4) in 15.8s
Collecting build traces in 5.7s
Finalizing page optimization in 5.9s

Route (app)
┌ ○ /
└ ○ /_not-found


  (Static)  prerendered as static content

---

perating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11
Binaries:
  Node: 24.10.0
  npm: 11.6.2
  Yarn: 1.22.21
  pnpm: 10.19.0
  bun: 1.3.1
Relevant Packages:
  next: 16.0.1 // Latest available version is detected (16.0.1).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: standalone
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Jayllyz/next-bun-react-compiler

Resolved in Bun 1.3.2 : https://github.com/oven-sh/bun/releases/tag/bun-v1.3.2

To Reproduce

It fails with Turbopack :

git clone https://github.com/Jayllyz/next-bun-react-compiler
bun install
bun run build

$ next build
   ▲ Next.js 16.0.1 (Turbopack)
   - Experiments (use with caution):
     · serverActions
     ✓ turbopackFileSystemCacheForDev

   Creating an optimized production build ...

> Build error occurred
Error: Turbopack build failed with 1 errors:
./src/app/page.tsx
Error evaluating Node.js code
ResolveMessage: Cannot find module './node_modules/.bun/[email protected]/node_modules/babel-plugin-react-compiler' from '/Users/jayllyz/code/my-app/node_modules/.bun/[email protected]+f98dd74b6b4c2783/node_modules/next/dist/compiled/babel/bundle.js'

Make sure that all the Babel plugins and presets you are using
are defined as dependencies or devDependencies in your package.json
file. It's possible that the missing plugin is loaded by a preset
you are using that forgot to add the plugin to its dependencies: you
can workaround this problem by explicitly adding the missing package
to your top-level package.json.


Import traces:
  Client Component Browser:
    ./src/app/page.tsx [Client Component Browser]
    ./src/app/page.tsx [Server Component]

  Client Component SSR:
    ./src/app/page.tsx [Client Component SSR]
    ./src/app/page.tsx [Server Component]


    at <unknown> (file. It's possible that the missing plugin is loaded by a preset)
    at processTicksAndRejections (null)
error: script "build" exited with code 1

It works with Webpack :

bun run build:webpack
$ next build --webpack
   ▲ Next.js 16.0.1 (webpack)

   Creating an optimized production build ...
 ✓ Compiled successfully in 3.6s
 ✓ Finished TypeScript in 984.7ms
 ✓ Collecting page data in 227.0ms
 ✓ Generating static pages (4/4) in 15.8s
 ✓ Collecting build traces in 5.7s
 ✓ Finalizing page optimization in 5.9s

Route (app)
┌ ○ /
└ ○ /_not-found


○  (Static)  prerendered as static content

Current vs. Expected behavior

Should use react compiler correctly.

Provide environment information

perating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11
Binaries:
  Node: 24.10.0
  npm: 11.6.2
  Yarn: 1.22.21
  pnpm: 10.19.0
  bun: 1.3.1
Relevant Packages:
  next: 16.0.1 // Latest available version is detected (16.0.1).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

extent analysis

TL;DR

The issue can likely be resolved by upgrading Bun to version 1.3.2, as the problem is already fixed in that release.

Guidance

  • The error message indicates a problem with Turbopack and the babel-plugin-react-compiler module, suggesting a compatibility issue.
  • Upgrading Bun to version 1.3.2 may resolve the issue, as stated in the "Resolved in Bun 1.3.2" comment.
  • Verify that all dependencies, including Babel plugins and presets, are correctly defined in the package.json file.
  • If upgrading Bun is not feasible, try explicitly adding the missing babel-plugin-react-compiler package to the top-level package.json file as a temporary workaround.

Example

No code snippet is provided, as the issue is likely related to a version compatibility problem rather than a code-specific issue.

Notes

The issue seems to be specific to Turbopack and does not occur when using Webpack. The problem is already fixed in Bun version 1.3.2, so upgrading should resolve the issue.

Recommendation

Upgrade to Bun version 1.3.2, as it is stated to have fixed the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING