简体   繁体   中英

TypeError: Cannot read properties of null (reading 'default') in Next.js

Earlier my Next.js application started throwing TypeError: Cannot read properties of null (reading 'default') without me changing anything. Here is the complete log:

在此处输入图像描述

After some search I found this GitHub discussion and then realised that a colleague has deleted the image of one of our articles from our CMS. If you ever come across this, the solution is to render the Image tag after a check, like so:

{ article.image && <Image src={article.image} alt="" height={900} width={900} layout="responsive" /> }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM