Skip to content
← Back to activity

Public problem

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

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

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.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

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