After getting the following build error when generating the static pages for my Next.js 13 ISR application:
> Build error occurred Error: Export encountered errors on following paths: /(post)/[postUrl]/page: /find-out-the-event-type-of-a-html-input-change-in-vs-code /category/[categoryUrl]/page: /category/interview-questions at C:\Users\....
I quickly figured out that the URL
/find-out-the-event-type-of-a-html-input-change-in-vs-code
and the category
/category/interview-questions
were both changed or deleted in the database. After trying to rebuild the app a few times with
$ npm run build
and getting the same error, I figured that there must be cached data of previous Next.js builds. As a working solution I just deleted to .next folder in the root directory of Next.js and then ran
$ npm run build
again. Problem solved!