NuxtImg not loading the images - error with IPX
Heya, I am having issues with the NuxtImg module. I can't seem to get the images to work. Have anyone experienced this before? Tried putting the images inside public folder but also assets.
I check console and I get errors like shown in the images:
Am I doing something wrong?




11 Replies
Hi @Polak. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I can help you troubleshoot your NuxtImg loading issues. Based on the errors you're seeing, there are a few common problems that might be causing this:
Issue 1: Image Location
By default, the Nuxt Image module looks for images in the
public/
directory. If your images are in the assets/
directory, you need to configure this explicitly:
This tells the IPX provider where to look for your source images Link to configuration docs.
Issue 2: Image Path Format
When using NuxtImg, make sure you're using the correct path format:
The path should be relative to the configured directory Link to providers docs.
Issue 3: Sharp Installation
The 500 error might indicate an issue with the Sharp package, which is used by IPX for image processing. This is especially common in production environments:
To fix this, you might need to:
1. Install Sharp explicitly in your project:
2. If deploying to a Linux server, you might need to rebuild Sharp for that platform:
This ensures the correct binary files are included for your production environment Link to Stack Overflow solution.
Issue 4: Check Your Usage
Make sure you're using the NuxtImg component correctly:
If you're still having issues, try using the IPX provider explicitly in your configuration:
Let me know if any of these solutions help with your specific case!
GitHub: kapa.ai | Twitter: @kapa_ai | Made with 💛 by Kapa Team.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@260534435915628554> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai none of the stuff worked
Let me check the knowledge base for you again. One moment! :books:
----------------------
I'm sorry to hear that none of the previous suggestions worked for your NuxtImg issue. Let's try some additional troubleshooting approaches:
Additional Troubleshooting Steps
1. Check domains configuration - If you're using external images, make sure they're whitelisted:
You can also set this via environment variable:
NUXT_IMAGE_DOMAINS="example.com,yourdomain.com"
Link to providers docs
2. Try a different provider - You can specify a different provider directly in your component:
Link to provider usage
3. Move images to public folder temporarily - As a workaround, you could move your images to the public folder as mentioned in this Stack Overflow solution Link to Stack Overflow
4. Check for alias configuration - Make sure you don't have conflicting alias configurations:
Link to alias configuration
5. Try using a static image approach - If you're building a static site, you might need to prerender your images:
Link to static images docs
If you're still experiencing issues, it would be helpful to know:
- The exact error message you're seeing
- Your Nuxt version
- Your deployment environment (local, server type, etc.)
- The exact code you're using for the NuxtImg component
This would help provide more targeted troubleshooting steps for your specific situation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@260534435915628554> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai Can I "disable" whatever NuxtImg does in the background?
Let me check the knowledge base for you again. One moment! :books:
----------------------
Yes, you can disable or bypass the image optimization that NuxtImg performs in the background. Based on your previous issues with IPX, here are a few approaches:
Option 1: Use regular HTML img tag
The simplest way to bypass NuxtImg is to use the standard HTML
<img>
tag instead:
This will completely bypass the image optimization pipeline.
Option 2: Use the custom
prop
You can use the custom
prop on NuxtImg to take control of the rendering while still having access to the computed values:
This gives you the flexibility to use your own image source path directly Link to NuxtImg custom prop.
Option 3: Disable the module globally
If you want to disable the image module entirely, you can remove it from your Nuxt modules in your nuxt.config.ts
:
Option 4: Use the passThrough
modifier with certain providers
Some providers like ImageEngine support a passThrough
modifier that will serve the unaltered image:
Link to ImageEngine provider
These approaches should help you work around the IPX issues you're experiencing while still maintaining your site's functionality.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@260534435915628554> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai So I tried using the default <img> and that works. How come NuxtImg doesnt work?
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on your experience where the standard
NuxtImg processes paths differently than the standard img tag. When using NuxtImg, the path should be relative to the configured directory (public by default): Not with the full path that might work with regular img tags: 2. Directory Configuration By default, NuxtImg looks for images in the
<img>
tag works but <NuxtImg>
doesn't, there are several potential reasons for this issue:
Common Reasons Why NuxtImg Fails While Regular img Works
1. Image Path Resolution
NuxtImg processes paths differently than the standard img tag. When using NuxtImg, the path should be relative to the configured directory (public by default): Not with the full path that might work with regular img tags: 2. Directory Configuration By default, NuxtImg looks for images in the
public/
directory. If your images are in assets/
, you need to configure this explicitly:
As mentioned in a Stack Overflow solution, this configuration change can resolve 404 errors Link to Stack Overflow.
3. IPX Provider Issues
NuxtImg uses the IPX provider by default for image processing, which requires the Sharp library. If Sharp isn't properly installed or configured, you'll get errors like:
This is a common issue in production environments Link to Stack Overflow.
4. Dynamic Image Imports
If you're dynamically importing images, Nuxt3 handles this differently than Nuxt2. As noted in a Stack Overflow post, you might need to move images to the public folder as a workaround Link to Stack Overflow.
Troubleshooting Steps
1. Check your browser console for specific error messages
2. Verify that your image paths are correct for NuxtImg
3. Make sure the Sharp library is properly installed
4. Try using a simple test case with an image definitely in the public folder
If you're still experiencing issues, it might be worth sharing the specific error messages you're seeing for more targeted help.
In the meantime, continuing to use the standard <img>
tag is a perfectly valid workaround if NuxtImg is causing problems in your project.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@260534435915628554> Kapa.ai is still learning and improving, please let me know how I did by reacting below.