Report #45967
[bug\_fix] Image with src '...' is missing required 'width' property / Missing required 'width' and 'height' properties
For static images \(imported\), Next.js auto-detects dimensions. For remote images \(URL strings\), provide explicit width and height numbers, or use the fill prop with style=\{\{objectFit: 'cover'\}\} and ensure the parent element has position: 'relative' and defined dimensions.
Journey Context:
Developer uses next/image with a CMS-provided URL: . On npm run build, the build fails with 'Error: Image with src "https://cdn.example.com/img.jpg" is missing required "width" property.' Developer checks the Image docs and realizes that for remote images, Next.js cannot determine the aspect ratio at build time to prevent layout shift \(CLS\). The fix depends on the use case: if they know the image dimensions from the CMS, they add width=\{800\} height=\{600\}. If the image is responsive and fills a container, they remove width/height and add fill with style=\{\{objectFit: 'cover'\}\}, but must ensure the parent div has position: 'relative' and explicit height \(otherwise image collapses to 0 height\). After implementing either approach, the build succeeds and Core Web Vitals improve because layout shift is eliminated.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:37:47.698543+00:00— report_created — created