-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPX: File not found when using assets directory #1006
Comments
So this would be the correct way after you set the Where do you deploy? According to the docs, other directories than
|
I deploy to remote server in our organization intranet using CI/CD. I'm not using vercel, I did not set provider, so assume default image processing provider is used - IPX |
@alex-lmt Alright. If you don't set the |
Ah and do you deploy with |
Yes. For example image from /public/img/image.png this way is working normally:
We are using nuxt build |
@alex-lmt Do you also deploy the
|
@madebyfabian I'm relatively new in Nuxt, especially to CI/CD stuff, how to add desired directory to deploy or check whether it is being delpoyed or not? |
@alex-lmt Is there a reason you want to use the assets folder? Why not just go with the public folder? |
@madebyfabian according documentation and general advices like https://masteringnuxt.com/blog/handling-assets-in-nuxt-3, I choose assets folder as I assume image may change relatively often and I don't care of physical file name (it is ok to process it during build) |
I am also experiencing this issue. following. |
1 similar comment
I am also experiencing this issue. following. |
I am also experiencing this issue. |
Have the same issue. Would be great to know how to fix this. |
Hey, people, issue was reported with Nuxt image version 1.0.0-rc.2, it's already 1.1.0 released. Does anyone tried is the issue still exists in newest version? |
Yes i tried it with Version 1.1.0 and it doesn't work. Could be easyly reproduced locally. In my case i put all the images in assets/images, set provider to ipx and dir to assets/images in the config. Def works but as soon as i try build the images are missing. Also the bild bundle size indicate that the images are processed but the mapping seems to not be correct when build. |
It seems it only breaks when using a custom dir, even if its a subfolder of public |
Found a workaround: Do not use Nuxt Image, use Vuetifys v-img instead. |
I'm getting this error, even when using the default |
I am also off nuxt-image completely and using my own nuxt endpoints for img generation… |
I am also experiencing this issue. |
I'm having the same issue now. In developer console I see that the image is pointing to "http://localhost:3000/_ipx/_/icon.png" |
Same issue here, just update all with pnpm update. |
same issue in the latest version of Nuxt and Nuxt Image |
I also seem to have encountered the same issue in dev. Steps to reproduce:
|
This comment was marked as outdated.
This comment was marked as outdated.
i'm facing the same issue, i'm trying to use the public directory or even the asset as documentation is mentioning, but nothing works, i had to create the directory |
Hi.
However, this may not work under certain conditions. |
Same 404 error with /_ipx/ folder after "build" project. Using "@nuxt/image": "^1.3.0", "nuxt": "^3.10.3" |
This issue only seems to happen on Windows. On MacOS |
nope. I'm on latest macOs Sonoma |
If you want to run the application properly, changing the version of |
@jyagamino the images appear in development server but not in production build |
Unfortunately, for the time being, I've had to use a classic image tag. But given that our site has over a hundred images, changing them manually would be really tiring. While waiting for this bug to be fixed, I proceeded as follows after research : export default function useAsset(path: string): string {
const assets = import.meta.glob('~/assets/**/*', {
eager: true,
import: 'default',
})
// all my file startsWith '/' ex: /home/hero.png you'll need to adjust
return assets[`/assets${path}`]
} then i create inside components/NuxtImg.vue (override @nuxt/img NuxtImg component) <script setup lang="ts">
const props = defineProps(['src', 'width', 'height', 'alt', 'class'])
const img = (props.src.startsWith('https://')
?? props.src.startsWith('http://')) // link from external source
? props.src // use external source
: useAsset(props.src) // resolve path
</script>
<template>
<img
:src="img"
:width="props.width"
:height="props.height"
:alt="props.alt"
:class="props.class"
>
</template>
|
Following too. |
same issue in vercel #1281 |
ofc it took 3 hours to find this thread. Yeah ill just switch to v-img and lazyload |
How is it that everything always suck when its build in javascript |
So I've been looking to solve similar problems in Nuxt Content Assets, and it turns out there is a way you can do this. Nuxt Image makes any layer's public folder accessible via the // nuxt.config.ts
export default defineNuxtConfig({
extends: [
'assets'
]
}) // assets/nuxt.config.ts
export default defineNuxtConfig({
dir: {
public: __dirname
}
}) I would prefer that Nuxt Image would allow an array for |
I am having the same issue. I tried a Stackblitz: https://stackblitz.com/edit/nuxt-starter-ee1s9x But I can't upload images without a paid plan. Remote images work fine. I've tried the images in the How to reproduce: Then, follow their documentation: Usage
This just doesn't work at all. |
Is anyone able to reproduce a reproduction repo? I tried to, but I was able to get it to work. https://codesandbox.io/p/devbox/nuxt-image-1006-ipx-public-64qh3f |
Is there any news? |
This happens on linux too. |
👇In my case, this code works after running "npm run dev", but it doesn't work when using "npm run build". // nuxt.config.js
export default defineNuxtConfig({
image: {
dir: 'assets/images'
}) <template>
<NuxtImg src="/banner.jpeg" />
</template> 👇This code works after running "npm run build", but it doesn't work when using "npm run dev". <script setup>
import banner from "~/assets/images/banner.jpeg"
</script>
<template>
<NuxtImg :src="banner" />
</template> |
I saw that the 500 error i got with these had this error: ChatGPT recommended me to delete node_modules and do this:
So far I have not gotten the same error again, but not sure if this is a correct fix |
I'm using Nuxt 3.7.3, Nuxt image 1.0.0-rc.2
In a component, providing image from assets directory as src prop of does not render image, I see "404 IPX: File not found" error in JS console.
Same image with
<img>
tag works correctly.This works:
<img src="~/assets/img/banners/front-page-banner.png" alt="Banner" />
This does not work:
<NuxtImg src="~/assets/img/banners/front-page-banner.png" alt="Banner" />
Import also does not work. This does not work:
According documentation https://image.nuxt.com/get-started/configuration#dir I've added assets directory to nuxt.config:
dir: 'assets/img'
Now image is rendered normally using it this way:
<NuxtImg src="banners/front-page-banner.png" alt="Banner" />
But only on local development server, after building and deploying it image is not rendered and same error appears in JS console.
The text was updated successfully, but these errors were encountered: