iamshaunjp / nextjs-masterclass

All course files for the Next.js Master Class course on Net Ninja Pro.
141 stars 83 forks source link

Lesson 11: npm run build gives an error #13

Open digitael opened 1 month ago

digitael commented 1 month ago

I had the same error in my own version, so I downloaded the files from lesson 11 fresh off of GitHub. Both return the same error when trying to build the app:

$ npm run build

dojo-helpdesk@0.1.0 build next build

Build error occurred Error: Failed to collect page data for /tickets/[id] at C:\Users\chris\Documents\GitHub\Netninja-Next13-Masterclass\nextjs-masterclass-lesson-11\node_modules\next\dist\build\utils.js:1158:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { type: 'Error' }

vitamins999 commented 1 month ago

I had the same problem and managed to solve it. Turns out JSON Server needs to be running when you build, otherwise Next can't fetch from the end point (because it isn't there).