Next.js Discord

Discord Forum

Unable to deploy Next.js app with NX due to `routes-manifest.json` not found

Unanswered
Braque d'Auvergne posted this in #help-forum
Open in Discord
Braque d'AuvergneOP
Hey all - I have a thread going in the NX discord as well but figured I'd ask here as well. I am getting this error when attempting to deploy an NX app with vercel:

Error: The file "/vercel/path0/dist/apps/willow-web/.next/routes-manifest.json" couldn't be found. This is often caused by a misconfiguration in your project.


Here's my vercel.json:

{
"buildCommand": "npx nx build willow-web --prod",
"outputDirectory": "dist/apps/willow-web/.next"
}


I can also verify that that file is being generated when I run nx build willow-web --prod and have followed the instructions here: https://nx.dev/recipes/react/deploy-nextjs-to-vercel. Is there anything else I should be doing?

2 Replies

Braque d'AuvergneOP
Tried a few things based on that article:

1. Added --skip-nx-cache (same result) npx nx build willow-web --prod --verbose --skip-nx-cache
2. Added the following to nx.json
  "targetDefaults": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["{workspaceRoot}/dist/apps/{projectRoot}/.next"]
    }
  }


3. Added the following to package.json
  "nx": {
    "targets": {
      "build": {
        "outputs": [
          "{projectRoot}/.next"
        ]
      }
    }
  }