An unhandled runtime error occurred
TypeError: Cannot read properties of undefined (reading 'listen')
This issue with dependency tree of installed TOAST UI Editor.
Before that, see the React code
// TOAST UI Editor
import "@toast-ui/editor/dist/toastui-editor.css";
import { Editor } from "@toast-ui/react-editor";
import "tui-color-picker/dist/tui-color-picker.css";
import "@toast-ui/editor-plugin-color-syntax/dist/toastui-editor-plugin-color-syntax.css";
import colorSyntax from "@toast-ui/editor-plugin-color-syntax";
export default function Write() {
...
return (
...
<Editor
previewStyle="vertical"
height="600px"
initialEditType="wysiwyg"
usageStatistics={false}
ref={editorRef}
plugins={[colorSyntax]}
/>
)
}
Module import and Apply plugins={[colorSyntax]} in Editor
and then solving the error.
First, Clean all installed modules and cache
rm -rf node_modules yarn.lock package-lock.json .next
Next, Install again
npm install
But I got a new error.
# Uninstall react & Modules related to toast-ui
npm uninstall react
npm uninstall @toast-ui/editor @toast-ui/react-editor @toast-ui/editor-plugin-color-syntax @toast-ui/editor-plugin-table-merged-cell
# If Error: Cannot find module 'babel-plugin-styled-components'
npm install babel-plugin-styled-components
# Install react & Modules related to toast-ui
npm install react
npm install @toast-ui/editor @toast-ui/react-editor @toast-ui/editor-plugin-color-syntax
Now, If run you can see
Source
'main > React' 카테고리의 다른 글
React innerHTML, DOM에 HTML텍스트 삽입하기. Apply dangerouslySetInnerHTML (0) | 2023.05.06 |
---|---|
[React] Re-Rendering과 Memoization (0) | 2023.03.12 |
[React] Context API, 전역 상태 관리하기, 두 개 이상의 Context 사용하기 (0) | 2021.11.15 |
[Webpack] robots.txt 추가 (0) | 2021.10.23 |
[React] Webpack 환경 설정에서 (.env) 환경 변수 사용하기 (0) | 2021.10.08 |