Next.js Discord

Discord Forum

Use Next/Image with a jpg

Answered
Lesser Black-backed Gull posted this in #help-forum
Open in Discord
Lesser Black-backed GullOP
Hi!

I can't figured out why my image is not working on production but is working on local. I'm using a .jpg and I've configured the next.config.js. My other .svg images are working fine on production. Any thoughts?

images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: '**',
        port: '',
        pathname: '**',
      }
    ]
  }


(config is temporary for tests purpose)

Error : Failed to load resource: the server responded with a status of 500 ()

Thank you so much.
Answered by Lesser Black-backed Gull
It worked after I installed sharp btw
View full answer

14 Replies

Lesser Black-backed GullOP
More details: my image is in the public folder.
@Lesser Black-backed Gull More details: my image is in the public folder.
since the image is local, why don't you statically import the image?
import image from "./path/to/image.png"

<Image src={image} />
oh you already do that
Lesser Black-backed GullOP
Yeah
since it's a 500, there should be something in the server log
check it
Lesser Black-backed GullOP
Ok I'm gonna check it
There are my logs
Do I need to install sharp ?
@Lesser Black-backed Gull There are my logs
hmm this is a known nextjs bug, either downgrade to 13.4.12 or upgrade to latest canary, at least one of them should work
Lesser Black-backed GullOP
Ok thank you so much!
Lesser Black-backed GullOP
It worked after I installed sharp btw
Answer
Lesser Black-backed GullOP
(without downgrading)