If your build fails, the related error is reported in the logs in the building accordion described above. To access these logs, you have the following options:
- If the failed build is the most recent deployment, you will see an Error in the Upcoming section below the Deployment preview on the Project's overview page. Click on the link next to the Error to be directed to the specific Deployment page
Error in the upcoming Deployment.
- You can also access the errored deployment's page from the Deployments tab, as shown below
Error in the Deployments tab.
- Once you are on the errored deployment's page, you will be shown a summary of the error in the preview section. This error can often be generic, as in the example below.
Error summary on a specific deployment's page.
To investigate further, open the Building accordion to expand the logs. Scroll down until you find a red section where Error is mentioned. It can be mentioned once or multiple times. In many cases, the last mention is not indicative, like in the example below, where it says yarn run build exited with 1. If you look a few lines above, you will see an additional error which, in this case, indicates where the problem is with a link for more details. Sometimes, an error may not be mentioned in the lines above, but the output will often help you identify where the problem is.
Error in the logs of the Building accordion.
It is recommended to build your project on your local machine first (the build command varies per project) before deploying on Vercel. This will catch issues specific to your code or to your project's dependencies. In the example above, when the command
npm run build(that runs
next build) is run in the local console for a Next.js project, the error happens after building locally.
Error in local console.