I use nextjs to build the frontend of my website. I recently added some code (which I'm pretty sure is correct) to my project.
After running npm run build
, I got an error that tells me that nextjs failed to collect the data for one of my pages.
> Build error occurred
Error: Failed to collect page data for /dashboard
at C:\Users\ga_bo\Desktop\my-project\node_modules\next\dist\build\utils.js:916:15 {
type: 'Error'
}
I recently upgraded the version of node I use from version 16 to version 18. I thought this caused the error, so I deleted the local repository of my project and reinstalled version 16 of node then reclone my project repo and then run npm run build
, but the error still occure.
I even tried removing the changes I made to the code and running npm run build
, but the error still occurs!!!
I am really confused about this error, please help me if you have any idea what is causing it.