Error when building Next JS app - default loader is not compatible with `next export`

Hi (-:

When building a Next JS app,
following the official Render docs, under " Deploy as a Static Site", we get this error during the build:

Apr 4 04:11:23 PM  Done in 10.75s.
Apr 4 04:11:23 PM  yarn run v1.22.18
Apr 4 04:11:23 PM  $ /opt/render/project/src/node_modules/.bin/next export
Apr 4 04:11:24 PM  info  - using build directory: /opt/render/project/src/.next
Apr 4 04:11:24 PM  info  - Copying "static build" directory
Apr 4 04:11:24 PM  info  - No "exportPathMap" found in "/opt/render/project/src/next.config.js". Generating map from "./pages"
Apr 4 04:11:24 PM  Error: Image Optimization using Next.js' default loader is not compatible with `next export`.
Apr 4 04:11:24 PM    Possible solutions:
Apr 4 04:11:24 PM      - Use `next start` to run a server, which includes the Image Optimization API.
Apr 4 04:11:24 PM      - Use any provider which supports Image Optimization (like Vercel).
Apr 4 04:11:24 PM      - Configure a third-party loader in `next.config.js`.
Apr 4 04:11:24 PM      - Use the `loader` prop for `next/image`.
Apr 4 04:11:24 PM    Read more:

Any ideas about what we are doing wrong?

We have responded via chat, but also following up here to close the loop:

If you deploy Next.js as a static site, Image Optimization API is not available since Next.js optimizes images on-demand, as users request them (not at build time).
You can try deploying you site as node server on Render or try other possible ways to fix.

For now I’ve just removed the import:

import Image from 'next/image'

And won’t use the Image component from Next.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.