image: images return 404 when using `nuxt generate` + vercel preset

Using nuxt-img with local images and they dont seem to work when the pages are prerendered. They throw a 404 error. Screenshot2022-10-29 at 21 23 51@2x

The images are displayed locally in dev environment. image

Reproduction - https://github.com/fayazara/nuxt-image-issue-reproduction

Deployed on Vercel - https://nuxt-image-issue-reproduction.vercel.app/ Deployed on Netlify - https://wondrous-medovik-574c06.netlify.app/

A remote image URL work btw. Happens only with local static images.

Build command was set to yarn generate

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 18
  • Comments: 15 (2 by maintainers)

Most upvoted comments

I believe I am seeing this issue too. It works fine when I do npm run dev but once I deploy to produciton, the local images are 404.

IPX Error: Error: File not found (/public/images/avatar-placeholder.svg)

This is also the case for me when using <nuxt-img> and local images. It works in dev, but not with build or generate. Tried on both linux and windows without success.

Anybody found a temporary fix to this yet?

Just to chime in. We have the same issue hosting it via NGINX and NGINX Ingress via K8s.

Turns out when you build the NUXT project, the static folder was not transferred, so we got 404s, but the output on our deployed instances did not have anything as NUXT does not package static during it’s build process.

After that was fixed, no more 404s and everything started working.

how did you fix this TheoParkos ?

same error for me, even after the #614 update