A Next.js build succeeds on Vercel, then the deploy cannot find routes-manifest.json
"routes-manifest.json" couldn't be foundShort answer
Vercel looks for the build output in the folder it expects, and routes-manifest.json is in it. When the error appears, Vercel is looking in the wrong place or the folder was never produced. Check the Output Directory and Build Command overrides, the Root Directory, then monorepo cache outputs.
Fix it fast
1Find out which cause you have
Run the same build locally and look at what folder it creates. That folder is what Vercel must be pointed at.
npx next build && ls .next/routes-manifest.json2Match what you see, then jump to its fix
- 1
Project Settings shows an Output Directory override, or vercel.json has outputDirectory.Output Directory is overridden to something Next.js does not build intoFix - 2
The build log ends quickly and no .next folder is listed.The Build Command is overridden and does not run next buildFix - 3
The repository has the Next.js app in a subfolder such as apps/web.The Root Directory points at the repository root, not the appFix - 4
The error appears only on cached builds, and a redeploy without the build cache works.Turborepo or Nx does not cache the Next.js outputFix
- 1
What does the error look like?
"routes-manifest.json" couldn't be foundNo Output Directory
Cause 1 of 4
Output Directory is overridden to something Next.js does not build into
1Check
For Next.js, Vercel sets the output directory by itself. next.config only changes it when you set distDir.
grep -n "distDir" next.config.*
cat vercel.json 2>/dev/null | grep -n outputDirectory2Fix
Turn the Output Directory override off in Project Settings under Build and Deployment, and remove outputDirectory from vercel.json. If you really use a distDir, make both agree.
// next.config.js (only if you need a custom folder)
module.exports = {
distDir: 'build',
}3Verify
Redeploy; the build log passes the output step.
npx vercel --prodConfirmed by vercel.com
Cause 2 of 4
The Build Command is overridden and does not run next build
1Check
For Next.js Vercel runs the build script from package.json, or next build when there is none. An override can replace it with something that does not build.
grep -n '"build"' package.json2Fix
Turn the Build Command override off, or set it to the real build command.
{
"scripts": { "build": "next build" }
}3Verify
The deployment log shows the Next.js route table at the end of the build.
npx next buildConfirmed by vercel.com
Cause 3 of 4
The Root Directory points at the repository root, not the app
1Check
In a repository where the app lives in a subfolder, Vercel needs that folder as the project Root Directory.
ls apps/web/package.json apps/web/next.config.* 2>/dev/null2Fix
Open Project Settings, Build and Deployment, Root Directory, and enter the app folder (for example apps/web).
# Project Settings > Build and Deployment > Root Directory: apps/web3Verify
Redeploy, then confirm the build log starts in that folder.
npx vercel --prodConfirmed by vercel.com
Cause 4 of 4
Turborepo or Nx does not cache the Next.js output
1Check
Vercel's guide says the error shows when the correct directories are not cached between builds. Redeploy without the cache to test this.
cat turbo.json2Fix
Declare the Next.js output in the build task so it is restored from the cache.
{
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**"]
}
}
}3Verify
Deploy twice in a row; the second, cached build also passes.
npx turbo run buildConfirmed by vercel.com
How do I stop it coming back?
- Leave Build Command and Output Directory on the framework default unless you have a reason.
- Set the Root Directory once when you import a monorepo, and write it into your setup notes.
- Keep distDir out of next.config unless something requires it.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Web apps
My Next.js app deployed to Vercel shows a 404 page not found
The page works with next dev but not on the Vercel URL
A 404 after a Vercel deploy usually means Vercel built or served the wrong thing.
4 causes, each with a fixBack end
create-next-app keeps creating a TypeScript project
Would you like to use TypeScript? No / Yes
create-next-app now makes a TypeScript project by default.
2 causes, each with a fixBack end
Show a custom sign-in error in NextAuth without leaving the page
http://localhost:3000/api/auth/error?error=...
By default a failed NextAuth credentials sign-in navigates to the error page with the message in the URL.
3 causes, each with a fixBack end
TypeScript does not know the custom fields you add to the NextAuth user
Property 'role' does not exist on type 'User | AdapterUser'.
NextAuth ships fixed types for User, Session and JWT, so a field like role is unknown to TypeScript until you declare it.
3 causes, each with a fixBack end
Request body is rejected as too large in Next.js (1 MB default)
413 Payload Too Large
Next.js limits request bodies to 1 MB by default, in both Pages Router API routes and Server Actions.
3 causes, each with a fixBack end
Next.js server code cannot connect to its own API on 127.0.0.1
Error: connect ECONNREFUSED 127.0.0.1:3003
ECONNREFUSED means nothing was listening at that address and port when the server-side fetch ran.
2 causes, each with a fix