Prerender Error
Why This Error Occurred​
While prerendering a page an error occurred. This can occur for many reasons from adding non-pages e.g. components to your pages folder or expecting props to be populated which are not.
Possible Ways to Fix It​
- Use Next.js 13 (or higher) and the App Router, which allows colocation of pages and other files (e.g. components, styles, tests, etc)
- Make sure to move any non-pages out of the
pagesfolder - Check for any code that assumes a prop is available, even when it might not be
- Set default values for all dynamic pages' props (avoid
undefined, usenullinstead so it can be serialized) - Check for any out of date modules that you might be relying on
- Make sure your component handles
fallbackif it is enabled ingetStaticPaths. Fallback docs - Make sure you are not trying to export (
output: 'export'ornext export) pages that have server-side rendering enabledgetServerSideProps - If necessary, you can disable server-side rendering for a specific component that may be attempting to use browser APIs like
window