Skip to content
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

next/image doesn't work but img jsx works #65232

Closed
MikeyA-yo opened this issue May 1, 2024 · 3 comments
Closed

next/image doesn't work but img jsx works #65232

MikeyA-yo opened this issue May 1, 2024 · 3 comments
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization. locked

Comments

@MikeyA-yo
Copy link

Link to the code that reproduces this issue

https://github.com/MikeyA-yo/bibleapp/blob/main/components/minimal-issue.tsx

To Reproduce


import Image from "next/image";
<Image src={imgsrc} height={876} width ={544} alt = 'image alt' />

Current vs. Expected behavior

I get that error and no image rendered

 ⚠ Fast Refresh had to perform a full reload when \bibleapp\\bible\\node_modules\\next\\dist\\client\\image-component.js","ids":[]} changed. Read more: https://nextjs.org/docs/messages/fast-refresh-reload

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 8107
  Available CPU cores: 4
Binaries:
  Node: 21.5.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: 14.2.3
  react: 18.3.0
  react-dom: 18.3.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Image (next/image)

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

normal img jsx works with the code solution above and renders the image that's what i'm using now, but i just decided to help file this bug report for the sake of optimization and more features from next/image

@MikeyA-yo MikeyA-yo added the bug Issue was opened via the bug report template. label May 1, 2024
@github-actions github-actions bot added the Image (next/image) Related to Next.js Image Optimization. label May 1, 2024
@shubhankartrivedi
Copy link

import crossImage from '../public/cross.jpg';
<Image src={crossImage} height={876} width ={544} alt = 'image alt'/>

You have to use this syntax for src prop. Don't put the /cross.jpg. Just do this and it will work as expected.

@MikeyA-yo
Copy link
Author

ohk thanks this works, but previously that kind of path works for my older projects

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization. locked
Projects
None yet
Development

No branches or pull requests

2 participants