Next JS build failing due to ''Export encountered errors on following paths"

Solution 1:

The problem was resolved by outputting the following log. All pages have been logged.

export async function getStaticProps({ params: {slug} }) {
  // ↓add 
  console.log(`Building slug: ${slug}`)
}

Solution 2:

I discovered that there was an object without a property that was needed to generate the page. Once I removed it, all was well