Images not showing but works locally

Hello!

My site is https://steady-stardust-e5352b.netlify.app/

The pictures are not showing, even though locally they work. My GitHub repository is this https://github.com/0tilia/digital-business-card/tree/main

I tried searching for an answer, but I didn’t manage to solve this issue on my own. I am a beginner at programming.

Hi @Otilia , thanks for the post and welcome.
Kindly check the forum link below and follow the suggestion there as the problem is similar to yours.

Let me know the outcome.

Thanks.

@Otilia The answer has already been given by @clarnx, but you can also check the relevant Vite documentation:

See:
Vite - Static Asset Handling
Vite - The public Directory

For future debugging also make sure to run your build command locally when trying to pinpoint what is occuring.

The develop command doesn’t perform the same thing and thus it’s fairly easy to end up in a situation where it appears to “work locally” but “doesn’t work on Netlify”, but it’s really just the difference between what develop is doing and what build does.

In this situation if you run your build command and then serve the output directly with npx serve you’ll find that it displays the same thing as on Netlify.

1 Like