Gustavo Morilla
Gustavo Morilla

Reputation: 342

Vercel Next.js build error while prerendering pages

I'm running Vercel compilation on my website and I can't get rid of the pre-rendering error on export. does anyone know the reason for this to happen and can help me with this? my github with all code: https://github.com/M0rilla/MyProfile

for each page have a error as above:

    Error occurred prerendering page "/resume". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

Error: Export encountered errors on following paths:
21:20:09.541        /
21:20:09.541        /404
21:20:09.541        /500
21:20:09.541        /experiences
21:20:09.542        /resume
21:20:09.542        /skills

i dont have a custom 404 or 500 page.

Upvotes: 12

Views: 21315

Answers (2)

pak
pak

Reputation: 39

Have you tried checking these cases:

  • Make sure to move any non-pages out of the pages folder
  • Check for any code that assumes a prop is available even when it might not be. e.g., have default data for all dynamic pages' props.
  • Check for any out of date modules that you might be relying on
  • Make sure your component handles fallback if it is enabled in getStaticPaths. Fallback docs
  • Make sure you are not trying to export (next export) pages that have server-side rendering enabled (getServerSideProps)

(source)

Upvotes: 2

dominicm00
dominicm00

Reputation: 1600

Vercel does some custom work in regards to next builds, so committing the .next build artifacts from your local machine or your node_modules folder can interfere with the build in unpredictable ways that give seemingly nonsensical error messages. Make sure to not commit either .next or node_modules to avoid this behavior.

Upvotes: 5

Related Questions