nextjs - 💡(How to fix) Fix turbopack: module not found in commonjs package [4 comments, 4 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#86458Fetched 2026-04-08 02:10:54
View on GitHub
Comments
4
Participants
4
Timeline
14
Reactions
2
Author
Timeline (top)
commented ×4subscribed ×4labeled ×2closed ×1

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Thu Nov 13 23:35:49 PST 2025; root:xnu-12377.61.11~7/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 22.13.0
  npm: 11.5.1
  Yarn: N/A
  pnpm: 10.22.0
Relevant Packages:
  next: 16.0.3 // Latest available version is detected (16.0.3).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

---

./node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/test/helper.js:33:15
Module not found: Can't resolve 'why-is-node-running'
  31 |
  32 | if (process.env.SKIP_PROCESS_EXIT_CHECK !== 'true') {
> 33 |   const why = require('why-is-node-running')
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  34 |   setInterval(why, 10000).unref()
  35 | }
  36 |



Import trace:
  Server Component:
    ./node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/test/helper.js
    ./node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/index.js
    ./node_modules/.pnpm/pino@10.1.0/node_modules/pino/lib/transport.js
    ./node_modules/.pnpm/pino@10.1.0/node_modules/pino/pino.js
    ./packages/utils/dist/logger.js
    ./apps/web/app/logger.ts
    ./apps/web/app/page.tsx

https://nextjs.org/docs/messages/module-not-found


    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
/Users/aulon/dev/personal/monorepo-transpile-repro-repo/apps/web:
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/aulonm/nextjs-16-turbopack-bug-repro-repo/tree/build-bug

To Reproduce

  1. pnpm i
  2. pnpm build:packages
  3. pnpm build

Current vs. Expected behavior

Current behavior

Next build stopped working after we upgraded next from 16.0.2 to 16.0.3

Getting module not found on one of our internal packages. I've managed to create a reproduction repo (branch build-bug). We create our own logger that is built in commonjs since we have some internal web apps that are still expecting it to be cjs.

This has worked perfectly fine, but suddenly it stopped working and we don't really know why. Could be our package has a bug, but it works perfectly fine with webpack as well.

Expected behavior

next build should work as it did in 16.0.2

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Thu Nov 13 23:35:49 PST 2025; root:xnu-12377.61.11~7/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 22.13.0
  npm: 11.5.1
  Yarn: N/A
  pnpm: 10.22.0
Relevant Packages:
  next: 16.0.3 // Latest available version is detected (16.0.3).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Turbopack

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

next build (local)

Additional context

tbh not sure if its commonjs problem or not

I've managed to find the canary version that introduced these problems for us. It started at 16.0.2-canary.7, hope this helps. Everything before that canary version works perfectly fine

Console spits out:

./node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/test/helper.js:33:15
Module not found: Can't resolve 'why-is-node-running'
  31 |
  32 | if (process.env.SKIP_PROCESS_EXIT_CHECK !== 'true') {
> 33 |   const why = require('why-is-node-running')
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  34 |   setInterval(why, 10000).unref()
  35 | }
  36 |



Import trace:
  Server Component:
    ./node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/test/helper.js
    ./node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/index.js
    ./node_modules/.pnpm/pino@10.1.0/node_modules/pino/lib/transport.js
    ./node_modules/.pnpm/pino@10.1.0/node_modules/pino/pino.js
    ./packages/utils/dist/logger.js
    ./apps/web/app/logger.ts
    ./apps/web/app/page.tsx

https://nextjs.org/docs/messages/module-not-found


    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
/Users/aulon/dev/personal/monorepo-transpile-repro-repo/apps/web:

extent analysis

TL;DR

Downgrade Next.js to version 16.0.2 to resolve the module not found issue.

Guidance

  • The issue seems to be related to the upgrade of Next.js from 16.0.2 to 16.0.3, as the problem started after the upgrade.
  • The error message indicates a module not found issue, but the actual problem might be related to the compatibility of the thread-stream package with the new version of Next.js.
  • Try downgrading Next.js to 16.0.2 to see if the issue resolves, as the reproduction repository works fine with this version.
  • If downgrading is not feasible, try to update the thread-stream package to the latest version to see if it resolves the issue.

Example

No code example is provided as the issue seems to be related to the compatibility of packages rather than a code-specific problem.

Notes

The issue might be specific to the combination of packages and versions used in the project, so the solution might not work for everyone. Additionally, downgrading Next.js might introduce other compatibility issues, so it's essential to weigh the pros and cons before making any changes.

Recommendation

Apply workaround: Downgrade Next.js to version 16.0.2, as it is the last known working version for this specific project. This should resolve the module not found issue, but it's crucial to monitor the project for any potential compatibility issues that might arise from downgrading.

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…

FAQ

Expected behavior

next build should work as it did in 16.0.2

Still need to ship something?

×6

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

Back to top recommendations

TRENDING