Missing routes-manifest.json file or No Output Directory when using Turborepo or NX

How to solve the error `The file "/vercel/path0/apps/web/.next/routes-manifest.json" couldn't be found` or `No Output Directory` when using Turborepo or NX.
Last updated on January 11, 2024
Build, Deployment & Git

If you are experiencing the following error when deploying to Vercel using the Turborepo cache, it's likely the correct directories are not being cached between builds.

The file "/vercel/path0/apps/web/.next/routes-manifest.json" couldn't be found

A similar issue may also be seen when using NX or may include the following error instead

No Output Directory named "NAME"

Where "NAME" is the directory you have configured as the output.

A good way to determine if the problem lies with the cache would be to redeploy your project without the cache and see if this resolves the issue. If it does then it's likely the output directories are not correctly configured in either your `turbo.json` or `nx.json`.

For projects using Turborepo, take a look at their guide on configuring cache outputs. You can also check out their example projects, these all include a `turbo.json` file so take a look at ones that use the same framework as your own project to see what has been included in `outputs`.

See the example `turbo.json` for a Next.js project

{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": [
"^build",
],
"env": ["SOME_ENV_VAR", "API_KEY_VAR"],
"outputs": [".next/**", "!.next/cache/**"]
},
"web#build": {
// override settings for the "build" task for the "web" app
"dependsOn": [
"^build",
],
"env": ["SOME_OTHER_ENV_VAR"],
"outputs": ["dist/**"]
},
},
"globalEnv": [
"GITHUB_TOKEN", // env var that will impact the hashes of all tasks,
],
"globalDependencies": [
"tsconfig.json" // file contents will impact the hashes of all tasks,
]
}

For NX projects, please take a look at their guide on how caching works, including examples of correctly defining outputs either in your `package.json` or `nx.json` files.

Couldn't find the guide you need?