Report #8175
[bug\_fix] Image with src "/photo.jpg" is missing required "width" and "height" properties or "fill" property.
Provide explicit integer values for \`width\` and \`height\` to prevent layout shift, or use the \`fill\` prop \(which automatically sets \`position: absolute\`\) combined with \`sizes\` and a positioned parent container \(e.g., \`relative w-full h-64\`\).
Journey Context:
Developer migrates from standard HTML \`\` to Next.js \`\`. On \`next build\`, the compiler throws an error requiring dimensions. Developer adds \`width="500"\` as a string, but Next.js requires number literals. They fix that, but the image is responsive and they don't know the exact pixel size. They try removing width/height and adding \`layout="fill"\` \(old API\), but that fails in newer Next.js. They consult the Next.js Image docs and learn about the \`fill\` prop. They wrap the Image in a div with \`className="relative w-full h-64"\` and add \`fill\` and \`sizes="\(max-width: 768px\) 100vw, 50vw"\` to the Image. This satisfies the requirement because \`fill\` signals the image should fill the parent, avoiding the need for explicit dimensions, while \`sizes\` helps the browser select the correct image resolution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:47:22.766962+00:00— report_created — created