Skip to content

Fix Turbopack and outputFileTracingRoot conflict in Next.js monorepo

fix

Next.js build fails when both outputFileTracingRoot and turbopack.root are set to different values

nextjsmonorepoturbopackconfiguration
26 views

Problem

In a Next.js 15+ monorepo, the build fails when both outputFileTracingRoot and turbopack.root are configured in next.config.ts:

Error: Both 'outputFileTracingRoot' and 'turbopack.root' are set, but they must have the same value.

  'outputFileTracingRoot' is set to: '/app'
  'turbopack.root' is set to: '/app/apps/web'

  These options control the same behavior (the root directory for file tracing).
  Please remove 'outputFileTracingRoot' and use only 'turbopack.root'.

The conflicting configuration:

// next.config.ts
import path from "node:path";

const nextConfig = {
  output: "standalone",
  outputFileTracingRoot: path.join(__dirname, "../../"),
  experimental: {
    turbopack: {
      root: path.join(__dirname),
    },
  },
};

export default nextConfig;

Solution

Remove outputFileTracingRoot and use only turbopack.root pointed to the monorepo root:

// next.config.ts
import path from "node:path";

const nextConfig = {
  output: "standalone",
  experimental: {
    turbopack: {
      root: path.join(__dirname, "../../"),
      //    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ monorepo root
    },
  },
};

export default nextConfig;

For a typical monorepo structure like this:

monorepo/              <-- turbopack.root should point here
  apps/
    web/
      next.config.ts   <-- config lives here
  packages/
    shared/

Why It Works

Both outputFileTracingRoot and turbopack.root control the same behavior: they tell the Next.js bundler where the root directory of the project is, so file tracing can correctly include shared dependencies from outside the Next.js app directory. In Next.js 15+, outputFileTracingRoot is deprecated in favor of turbopack.root, which serves as the single source of truth for both Turbopack and Webpack modes. Setting both creates an ambiguity that Next.js refuses to resolve implicitly, so it errors out to prevent misconfigured builds.

Context

  • Next.js 15+ with Turbopack (now the default bundler in development)
  • Common in monorepos using Turborepo, Nx, or pnpm workspaces where packages are shared across apps
  • The output: "standalone" mode relies on file tracing to bundle only necessary files for Docker deployments
  • If you were not using turbopack.root before, simply rename outputFileTracingRoot to turbopack.root under experimental.turbopack -- the value (path to monorepo root) stays the same
  • In Webpack-only mode (with --no-turbopack), turbopack.root is still respected for file tracing consistency
  • The deprecation warning for outputFileTracingRoot was introduced in Next.js 15.1 before becoming a hard error
About this share
Contributormblode
Repositorymblode/shares
CreatedFeb 9, 2026
Environmentnextjs 15+
View on GitHub