question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Vercel build fails with "Error: The file "/vercel/path0/dist/routes-manifest.json" couldn't be found."

See original GitHub issue

Provide environment information

 System:
    OS: Linux 6.0 Ubuntu 22.10 22.10 (Kinetic Kudu)
    CPU: (4) x64 Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
    Memory: 452.24 MB / 3.76 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
    npm: 9.1.2 - ~/.nvm/versions/node/v16.18.1/bin/npm
"ct3aMetadata": {
  "initVersion": "6.11.0"
}

Describe the bug

Following the installation and setting the db to mysql for planetscale makes the Vercel build fail with the following error:

Error: The file "/vercel/path0/dist/routes-manifest.json" couldn't be found. This is normally caused by a misconfiguration in your project.
Please check the following, and reach out to support if you cannot resolve the problem:
   1. If present, be sure your `build` script in "package.json" calls `next build`.  2. Navigate to your project's settings in the Vercel dashboard, and verify that the "Build Command" is not overridden, or that it calls `next build`.  3. Navigate to your project's settings in the Vercel dashboard, and verify that the "Output Directory" is not overridden. Note that `next export` does **not** require you change this setting, even if you customize the `next export` output directory.
 Learn More: https://err.sh/vercel/vercel/now-next-routes-manifest

To reproduce

  1. Follow the installation instructions, select all options (npm create t3-app@latest)
  2. Change the db to mysql in planetscale (and add the indexs and relation_mode option)
  3. Go to vercel, create the project
  4. Add the env variables a. (not sure if this causes the bug, but i put it just in case) Connect planetscale and vercel through their integration
  5. Trigger a build
  6. You get the error and the build fails

Additional information

Repo I’m working on: https://github.com/mauriciabad/dive-log

This is the literally only change I made to the generated code: Screenshot from 2022-12-04 04-56-33

Envoirement variables in Vercel

Screenshot from 2022-12-04 05-00-56

Build & Development Settings in Vercel

Screenshot from 2022-12-04 05-01-46

If I set the “Project Preset” to “Other”, the build succeeds, but the page returns a 400 error: Screenshot from 2022-12-04 04-46-23

Full Vercel log

[04:51:46.913] Retrieving list of deployment files...
[04:51:47.178] Previous build cache not available
[04:51:49.882] Downloading 45 deployment files...
[04:51:50.412] Running "vercel build"
[04:51:50.926] Vercel CLI 28.6.0
[04:51:51.238] Running "install" command: `npm install`...
[04:52:05.834] 
[04:52:05.835] > dive-log@0.1.0 postinstall
[04:52:05.835] > prisma generate
[04:52:05.835] 
[04:52:07.054] Environment variables loaded from .env
[04:52:07.056] Prisma schema loaded from prisma/schema.prisma
[04:52:08.189] 
[04:52:08.190] ✔ Generated Prisma Client (4.7.1 | library) to ./node_modules/@prisma/client in 110ms
[04:52:08.190] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[04:52:08.190] ```
[04:52:08.190] import { PrismaClient } from '@prisma/client'
[04:52:08.190] const prisma = new PrismaClient()
[04:52:08.190] ```
[04:52:08.224] 
[04:52:08.224] added 317 packages, and audited 318 packages in 17s
[04:52:08.225] 
[04:52:08.225] 103 packages are looking for funding
[04:52:08.225]   run `npm fund` for details
[04:52:08.226] 
[04:52:08.226] found 0 vulnerabilities
[04:52:08.246] Detected Next.js version: 13.0.2
[04:52:08.248] Running "npm run build"
[04:52:08.559] 
[04:52:08.559] > dive-log@0.1.0 build
[04:52:08.559] > next build
[04:52:08.559] 
[04:52:08.858] info  - Loaded env from /vercel/path0/.env
[04:52:09.004] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[04:52:09.004] This information is used to shape Next.js' roadmap and prioritize features.
[04:52:09.004] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[04:52:09.004] https://nextjs.org/telemetry
[04:52:09.004] 
[04:52:09.131] info  - Linting and checking validity of types...
[04:52:14.260] info  - Creating an optimized production build...
[04:52:20.975] info  - Compiled successfully
[04:52:20.975] info  - Collecting page data...
[04:52:25.837] info  - Generating static pages (0/6)
[04:52:25.923] info  - Generating static pages (1/6)
[04:52:25.938] info  - Generating static pages (2/6)
[04:52:25.950] info  - Generating static pages (4/6)
[04:52:25.970] info  - Generating static pages (6/6)
[04:52:25.982] info  - Finalizing page optimization...
[04:52:25.985] 
[04:52:26.004] Route (pages)                              Size     First Load JS
[04:52:26.006] ┌ ○ /                                      3.28 kB         110 kB
[04:52:26.006] ├   /_app                                  0 B             107 kB
[04:52:26.006] ├ ○ /404                                   181 B           107 kB
[04:52:26.006] ├ λ /api/auth/[...nextauth]                0 B             107 kB
[04:52:26.006] ├ λ /api/examples                          0 B             107 kB
[04:52:26.007] ├ λ /api/restricted                        0 B             107 kB
[04:52:26.007] └ λ /api/trpc/[trpc]                       0 B             107 kB
[04:52:26.007] + First Load JS shared by all              109 kB
[04:52:26.007]   ├ chunks/framework-3b5a00d5d7e8d93b.js   45.4 kB
[04:52:26.007]   ├ chunks/main-94d897311acc2837.js        27.1 kB
[04:52:26.007]   ├ chunks/pages/_app-4e49c70b8a55ab64.js  33.2 kB
[04:52:26.007]   ├ chunks/webpack-ee7e63bc15b31913.js     815 B
[04:52:26.007]   └ css/14a4ce6fb40c3e06.css               2.16 kB
[04:52:26.007] 
[04:52:26.008] λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
[04:52:26.008] ○  (Static)  automatically rendered as static HTML (uses no initial props)
[04:52:26.008] 
[04:52:26.389] Error: The file "/vercel/path0/dist/routes-manifest.json" couldn't be found. This is normally caused by a misconfiguration in your project.
[04:52:26.389] Please check the following, and reach out to support if you cannot resolve the problem:
[04:52:26.390]   1. If present, be sure your `build` script in "package.json" calls `next build`.  2. Navigate to your project's settings in the Vercel dashboard, and verify that the "Build Command" is not overridden, or that it calls `next build`.  3. Navigate to your project's settings in the Vercel dashboard, and verify that the "Output Directory" is not overridden. Note that `next export` does **not** require you change this setting, even if you customize the `next export` output directory.
[04:52:26.390] Learn More: https://err.sh/vercel/vercel/now-next-routes-manifest

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
mauriciabadcommented, Dec 4, 2022

I fixed it by deleting the vercel.json file and removing the overrides.

It’s weird that the problem is the vercel.json file. Maybe the commands in it are wrong, because in the overrides i had the same as in vercel.json, so maybe Vercel is using other ones.

1reaction
jabali2004commented, Dec 4, 2022

After I deleted the vercel.json from the documentation it worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command to build Next.js for Vercel errors out #5748 - GitHub
Try to deploy it to Vercel following the guide in the NX Next.js docs. ... NX ERROR Running target "frontend:build" failed Failed tasks: ......
Read more >
NextJs vercel deployment error "routes-manifest.json" couldn't ...
Run npm run build (check all files in builded folder); Create .next folder and move all files from build folder to .next; Commit...
Read more >
Vercel Build Fails The file "/vercel/path0/.next/routes-manifest ...
Vercel Build Fails The file "/vercel/path0/.next/routes-manifest.json" couldn't be found.
Read more >
Developer Support - Plasmic Community
Error : The file “/vercel/path0/.next/routes-manifest.json” couldn't be found. This is normally caused by a misconfiguration in your project.
Read more >
Errors – Vercel Docs
A list of errors provided by Vercel CLI or the REST API, with details on how they occur and how to resolve them....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found