[next] Update "Routes Manifest" Error (#4368)

This provides the user with additional troubleshooting steps.
This commit is contained in:
Joe Haddad
2020-05-14 22:11:10 -04:00
committed by GitHub
parent e4833027bd
commit 3ad2efeb74
2 changed files with 14 additions and 4 deletions

View File

@@ -2,10 +2,15 @@
#### Why This Error Occurred
This could be caused by a failure during the build or an incorrect output directory being configured for your Next.js project.
This could be caused by a misconfigured "Build Command" or "Output Directory" for your Next.js project.
#### Possible Ways to Fix It
Check for any build errors in the logs and ensure that the output directory setting is either not changed or is pointing to the location of the `.next` output folder (`distDir`).
In the Vercel dashboard, open your "Project Settings" and draw attention to "Build & Development Settings":
If you are running `next export` you should **not** need to customize the output directory to `out` since the builder automatically detects `next export` being run and uses the output from it.
1. Ensure that the "Build Command" setting is not changed, or that it calls `next build`. If this command is not changed but you are seeing this error, double check that your `build` script in `package.json` calls `next build`.
2. Ensure that the "Output Directory" setting is not changed. This value almost never needs to be configured, and is only necessary if you override `distDir` in `next.config.js`.
3. For `next export` users: **do not override the "Output Directory"**. Next.js automatically detects what folder you outputted `next export` to.
In rare scenarios, this error message can also be caused by a Next.js build failure (if your "Build Command" accidentally returns an exit code that is not 0).
Double check for any error messages above the Routes Manifest error, which may provide additional details.

View File

@@ -338,7 +338,12 @@ export async function getRoutesManifest(
if (shouldHaveManifest && !hasRoutesManifest) {
throw new NowBuildError({
message: `A "routes-manifest.json" couldn't be found. Is the correct output directory configured? This setting does not need to be changed in most cases`,
message:
`A "routes-manifest.json" couldn't be found. This is normally caused by a misconfiguration in your project.\n` +
'Please check the following, and reach out to support if you cannot resolve the problem:\n' +
' 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. `next export` does **not** require you change this setting, even if you customize the `next export` output directory.',
link: 'https://err.sh/zeit/now/now-next-routes-manifest',
code: 'NEXT_NO_ROUTES_MANIFEST',
});