nextjs - 💡(How to fix) Fix Next.JS 16 Build with turbopack. Error: Could not parse module '[project]/node_modules/next/dist/server/route-modules/app-route/vendored/contexts/router-context.js', file not found [1 comments, 2 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#88808Fetched 2026-04-08 02:03:57
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×2closed ×1commented ×1issue_type_added ×1

Error Message

Collecting page data using 11 workers ...Error: Could not parse module '[project]/node_modules/next/dist/server/route-modules/app-route/vendored/contexts/router-context.js', file not found

Build error occurred Error: Failed to collect page data for /api/consent type: 'Error'

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:56 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 12
Binaries:
  Node: 25.3.0
  npm: 11.7.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.1.4 // Latest available version is detected (16.1.4).
  eslint-config-next: 15.5.9
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://localhost

To Reproduce

  1. Next build. Setup with nx monorepo. Using pages route to prerender static pages.

nx Report Node : 25.3.0 OS : darwin-arm64 Native Target : aarch64-macos yarn : 1.22.22

nx (global) : 22.3.3 nx : 22.3.3 @nx/js : 22.3.3 @nx/eslint : 22.3.3 @nx/workspace : 22.3.3 @nx/jest : 22.3.3 @nx/cypress : 22.3.3 @nx/devkit : 22.3.3 @nx/eslint-plugin : 22.3.3 @nx/module-federation : 22.3.3 @nx/next : 22.3.3 @nx/react : 22.3.3 @nx/rollup : 22.3.3 @nx/storybook : 22.3.3 @nx/vite : 22.3.3 @nx/vitest : 22.3.3 @nx/web : 22.3.3 @nx/webpack : 22.3.3 typescript : 5.9.3

Community plugins: @webpro/nx-tsc : 0.0.2

Cache Usage: 0.00 B / 46.04 GB

Current vs. Expected behavior

Collecting page data using 11 workers ...Error: Could not parse module '[project]/node_modules/next/dist/server/route-modules/app-route/vendored/contexts/router-context.js', file not found at instantiateModule (../../dist/apps/todo/.next/server/chunks/[turbopack]_runtime.js:740:9) at getOrInstantiateModuleFromParent (../../dist/apps/todo/.next/server/chunks/[turbopack]_runtime.js:763:12) at Context.commonJsRequire [as r] (../../dist/apps/todo/.next/server/chunks/[turbopack]_runtime.js:249:12) at instantiateModule (../../dist/apps/hcp-hub-nextjs-pilot/.next/server/chunks/[turbopack]_runtime.js:740:9) at getOrInstantiateModuleFromParent (../../dist/apps/todo/.next/server/chunks/[turbopack]_runtime.js:763:12) at Context.commonJsRequire [as r] (../../dist/apps/todo/.next/server/chunks/[turbopack]_runtime.js:249:12) at instantiateModule (../../dist/apps/hcp-hub-nextjs-pilot/.next/server/chunks/[turbopack]_runtime.js:740:9) { code: 'MODULE_UNPARSABLE' }

Build error occurred Error: Failed to collect page data for /api/consent at ignore-listed frames { type: 'Error' }

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:56 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 12
Binaries:
  Node: 25.3.0
  npm: 11.7.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.1.4 // Latest available version is detected (16.1.4).
  eslint-config-next: 15.5.9
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Pages Router

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

next build (local)

Additional context

No response

extent analysis

TL;DR

The issue is likely related to a compatibility problem between Next.js and the @nx/next package, and a workaround may involve adjusting the Next.js configuration or updating the @nx/next package.

Guidance

  • Verify that the @nx/next package is compatible with the current version of Next.js (16.1.4) and consider updating @nx/next to the latest version.
  • Check the Next.js configuration for any custom settings that may be causing the issue, such as output settings or module resolutions.
  • Try to reproduce the issue with a minimal example to isolate the cause and determine if it's related to the @nx/next package or Next.js itself.
  • Consider checking the node_modules directory for any missing or corrupted files, especially the next/dist/server/route-modules/app-route/vendored/contexts/router-context.js file mentioned in the error message.

Example

No code example is provided as the issue is related to a specific package and configuration.

Notes

The issue may be specific to the @nx/next package and the current version of Next.js, and further investigation is needed to determine the root cause.

Recommendation

Apply a workaround by adjusting the Next.js configuration or updating the @nx/next package, as the issue is likely related to a compatibility problem between these two packages.

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

nextjs - 💡(How to fix) Fix Next.JS 16 Build with turbopack. Error: Could not parse module '[project]/node_modules/next/dist/server/route-modules/app-route/vendored/contexts/router-context.js', file not found [1 comments, 2 participants]