Next.js Discord

Discord Forum

Strange error after building

Answered
mae posted this in #help-forum
Open in Discord
maeOP
hiya, i've just made changes to my Next.js project and everything seemed to be going well until i built the website and got the following error:
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
    at nM (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61599)
    at nM (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61546)
    at nN (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
    at nB (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
    at nD (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:66680)
    at nN (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64853)
    at nB (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
    at nM (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:60046)
    at nN (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
    at nB (/Users/mae/Documents/Code/Projects/website/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
 ✓ Generating static pages (18/18)

> Export encountered errors on following paths:
        /(main)/page: /


this error dosen't occur when previewing the website in dev and i'm not sure what could be causing this. any advice? the /(main)/page page is attached
Answered by Sloth bear
Check the Custom <Tool> component error message mentions an issue related to an undefined component type
View full answer

5 Replies

maeOP
the only things i've done between before and now is run bun upgrade and upgrade nextjs, but vscode isn't showing any issues with any files
Sloth bear
Check the Custom <Tool> component error message mentions an issue related to an undefined component type
Answer
Sloth bear
Check if it's correctly imported
maeOP
Oh wtf, I moved it back to a regular import instead of a dynamic one and it just started working again! cant even remember why i had it as dynamic in the first place! thank you :dootLove: