Cannot find module 'next/dist/compiled/source-map' — 500 on every API route in production

No errors in development, but after deploying to Vercel every API route returns 500 Internal Server Error. Vercel logs show: Cannot find module 'next/dist/compiled/source-map'. Nothing in package.json references source-map directly. Reported on next 15.5.2 with Node 22 on Vercel.

A maintainer identified the cause: outputFileTracingRoot was set to a machine-specific absolute path from the reporter's own computer that does not exist in the Vercel build environment. That excludes Next.js runtime files, including next/dist/compiled/source-map, from the production file trace, so the module is missing at runtime. Fix: remove outputFileTracingRoot or resolve it to the actual monorepo root — per the docs it must point to your project root, not a local machine path. The issue was closed as a configuration issue once this was confirmed. Source: https://github.com/vercel/next.js/issues/83248