JS Algorithm
database
HTML/CSS
Javascript
Next
React
Terminal
Typescript
Vue
Etc
Git
목록 열기
June 29, 2021

Next.js Image hostname 에러 해결

Next.js 에서 Image 태그의 src 로 도메인 url 을 입력하면 발생하는 에러

Unhandled Runtime Error Error: Invalid src prop (https://lh3.googleusercontent.com/...) on next/image, hostname "lh3.googleusercontent.com" is not configured under images in your next.config.js See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host

next.config.js 에 해당 도메인을 추가해주면 해결된다.

next.config.js
module.exports = {
  ...
  images: {
    domains: ['lh3.googleusercontent.com', 'localhost']
  },
  ...
}
Top