본문 바로가기

문제 발생 및 해결

Unhandled Runtime ErrorError: Cannot read properties of undefined (reading 'inTable')

next.js 강의를 듣는 중...

import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";

// 생략
<ReactMarkdown remarkPlugins={[remarkGfm]}>
  {content}
</ReactMarkdown>

remarkPlugins 이 부분에서 오류가 발생함.

// 페이지

Unhandled Runtime ErrorError: Cannot read properties of undefined (reading 'inTable')

// node

- error node_modules\mdast-util-gfm-table\lib\index.js (123:0) @ Object.exitCodeText    
- error TypeError: Cannot read properties of undefined (reading 'inTable')

 

 

=> 해결

강의의 remark-gfm 버전과 달라서 생긴 문제. package.json에서 버전 낮춤.

// 변경 전
"remark-gfm": "^4.0.0",
// 변경 후
"remark-gfm": "^3.0.1",

 

 

 

+  아래 오류는 next.config.js를 수정해야 함.

Unhandled Runtime Error

Error: Invalid src prop (https://images.unsplash.com/photo-1633356122102-3fe601e05bd2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80) on `next/image`, hostname "images.unsplash.com" is not configured under images in your `next.config.js` See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host

 

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    appDir: true,
  },
  images: {
    domains: ["images.unsplash.com"],
  },
};

module.exports = nextConfig;