Next.js Discord

Discord Forum

(SOLVED) Unable to export as static files

Answered
Birman posted this in #help-forum
Open in Discord
BirmanOP
the I have been using Next JS to generate static files by running next build && next export. However only today I was not able to export as static files. I have not changed the next.config.js file from previous successful export. Why might this be happening? Any help or suggestion is welcome. Thanks for reading.

Error message reads as attached in error-log.txt

In next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  // For static exports only
  trailingSlash: true,
  images: { unoptimized: true }
}

module.exports = nextConfig

Dependency versions in package.json
    "next": "12.2.5",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "sharp": "^0.31.1"


Disclaimer - I was able to export as static files previously even if there were warnings for using <img> tags
Answered by Birman
My bad. Turns out I had one <Image /> component being used while trying to export as static file.
View full answer

1 Reply

BirmanOP
My bad. Turns out I had one <Image /> component being used while trying to export as static file.
Answer