nextjs - 💡(How to fix) Fix Turbopack: Path doubling with outputFileTracingRoot in monorepo causes vercel build failure [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#88579Fetched 2026-04-08 02:04:25
View on GitHub
Comments
1
Participants
2
Timeline
9
Reactions
1
Author
Participants
Timeline (top)
subscribed ×3labeled ×2referenced ×2commented ×1

Error Message

Error: ENOENT: no such file or directory, lstat '/path/to/apps/frontend/apps/frontend/.next/routes-manifest.json'

Root Cause

The path apps/frontend/ is doubled because outputFileTracingRoot causes the build to prepend the relative path from monorepo root, but we're already in that directory.

Code Example

Error: ENOENT: no such file or directory, lstat
'/path/to/apps/frontend/apps/frontend/.next/routes-manifest.json'

---

const path = require("path");

module.exports = {
  turbopack: {
    root: path.resolve(__dirname, "../.."),
  },
  outputFileTracingRoot: path.resolve(__dirname, "../.."),
  output: "standalone",
};
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/domhede/turbopack-monorepo-repro

To Reproduce

  1. Clone the repo: git clone https://github.com/domhede/turbopack-monorepo-repro
  2. Install dependencies: yarn install
  3. Navigate to frontend: cd apps/frontend
  4. Run Vercel build: npx vercel build

Current vs. Expected behavior

Expected: Build succeeds and produces a working standalone output.

Actual: Build fails with path doubling error:

Error: ENOENT: no such file or directory, lstat
'/path/to/apps/frontend/apps/frontend/.next/routes-manifest.json'

The path apps/frontend/ is doubled because outputFileTracingRoot causes the build to prepend the relative path from monorepo root, but we're already in that directory.

Provide environment information

  • Node.js: 24.x
  • Next.js: 15.3.3
  • Vercel CLI: 50.4.0

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

Turbopack, Output (standalone)

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

vercel build

Additional context

next.config.js:

const path = require("path");

module.exports = {
  turbopack: {
    root: path.resolve(__dirname, "../.."),
  },
  outputFileTracingRoot: path.resolve(__dirname, "../.."),
  output: "standalone",
};

Notes:

  • Without outputFileTracingRoot: turbopack.root is ignored and module resolution fails for workspace packages
  • With outputFileTracingRoot: Path doubling occurs during the build
  • There is currently no working configuration for Turbopack production builds in monorepos with shared packages
  • Standard next build works fine; the issue only occurs with vercel build

extent analysis

TL;DR

  • Adjust the outputFileTracingRoot configuration to prevent path doubling during the Vercel build process.

Guidance

  • Review the next.config.js file to ensure that the outputFileTracingRoot path is correctly set, considering the current working directory.
  • Verify that removing or adjusting the outputFileTracingRoot setting resolves the path doubling issue, while also ensuring that turbopack.root is correctly configured for module resolution.
  • Consider alternative configurations for turbopack.root and outputFileTracingRoot that balance the need for correct module resolution and avoidance of path doubling.
  • Test the build process with the adjusted configuration to confirm that the issue is resolved.

Example

// Potential adjustment to next.config.js
module.exports = {
  turbopack: {
    root: path.resolve(__dirname, "../.."),
  },
  // Adjust or remove outputFileTracingRoot to prevent path doubling
  outputFileTracingRoot: path.resolve(__dirname),
  output: "standalone",
};

Notes

  • The provided solution may require further refinement based on the specific monorepo structure and package dependencies.
  • The issue appears to be specific to the combination of Turbopack, Vercel build, and monorepo configuration, so the solution may not apply to other build environments or configurations.

Recommendation

  • Apply workaround: Adjust the outputFileTracingRoot configuration to prevent path doubling, as this appears to be the most direct solution to the issue, given the current limitations of Turbopack in monorepo environments.

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 Turbopack: Path doubling with outputFileTracingRoot in monorepo causes vercel build failure [1 comments, 2 participants]