Images returning 404 on using local images in Nuxt 3
See original GitHub issueUsing nuxt-img with local images and they dont seem to work when the pages are prerendered. They throw a 404 error.
The images are displayed locally in dev environment.
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
Issue Analytics
- State:
- Created a year ago
- Reactions:13
- Comments:6 (1 by maintainers)
Top Results From Across the Web
vue.js - image not found in assets when using @error in Nuxt
Based on this you need to use require because images inside assets directory are considered as modules : @error="$event.target.src ...
Read more >How to load dynamic images in Vue and Nuxt with ease
Importing images from the assets folder when the path is static is not that difficult in both frameworks, Vue and Nuxt.js.
Read more >nuxt-img
Uses built-in provider to optimize local and remote images; Converts src to provider optimized URLs; Automatically resizes images based on width and height ......
Read more >Nuxt npm run generate (404 assets not found) - Vue Forum
All my files in the assets folder show as “404 not found”. In my components I reference the images like ~/assets/img1.jpg .
Read more >Static Asset Handling - Vite
If using the Vue plugin, asset references in Vue SFC templates are automatically converted into imports. Common image, media, and font filetypes are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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)
Anybody found a temporary fix to this yet?