问题描述
我收到此错误
Error: Error serializing `.remarkBody` returned from `getStaticProps` in "/blog/[slug]".
Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value.
尝试运行时:
const body = blogPostCollection ? blogPostCollection?.items[0]?.body : ''
const remarkBody = remark().use(strip).process(body,(err,file) => {
if (err) throw err
String(file)
})
return {
props: {
remarkBody: remarkBody,},revalidate: 1
}
有人可以帮我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)