Module not found: Can't resolve 'react-dom' error #
To solve the error "Module not found: Error: Can't resolve 'react-dom'", make sure to install the react-dom package by opening your terminal in your project's root directory and running the command npm install react-dom react and restart your development server.
index.js 파일과 ErrorModal.js 파일에서 npm start를 하던 중 위와같은 오류가 발생했다고 떴었다.
어제까지만 해도 잘되더니 왜 안되는 것인가...
createPortal을 배워 그 코드를 넣고 나서 이렇게 안되는 것이라서
해당 파일인 ErrorModal파일의 모든 코드를 주석처리하고 실행해보았지만 그대로였다.
그러던 중 구글링에서 한 글을 발견했다.
https://bobbyhadz.com/blog/react-module-not-found-cant-resolve-react-dom
Module not found: Can't resolve 'react-dom' error | bobbyhadz
To solve the error Module not found: Error: Can't resolve 'react-dom', make sure to install the `react-dom` package by opening your terminal in your project's root directory and running the command `npm install react-dom react` and restart your development
bobbyhadz.com
꽤나 자세히 오류를 해결하는 방법에 대해 알려주고 있었다.
일단 내 package.json에는 react-dom 파일이 18버전인 것이 확실했고
존재하고 있었으므로 install을 해볼 생각을 하지 않고 있었는데
위의 글에서는 다시 install해보란다.
npm install react-dom react
을 명령어에 입력하고 설치되는 것을 기다렸다.
react-dom 파일버전이 "^18.0.0" 에서 "^18.2.0" 로 업그레이드 되었다.
설마 되겠어... 하지만 되더라... 뭔가 버전업그레이드를 하면서 문제해결을 해주었을까?
되고나니 일단 계속 진행하자...
'신나는 오류해결파티!!!' 카테고리의 다른 글
[에러] Manifest: Line: 1, column: 1, Syntax error (0) | 2023.01.12 |
---|---|
[오류기록] createPortal is not a function (0) | 2022.09.16 |
[오류기록] git add .안될때 Another git process seems to be running in this repository (0) | 2022.09.14 |
[오류기록] react_dom_client__WEBPACK_IMPORTED_MODULE_1___default.a.render is not a function (0) | 2022.09.12 |
[오류기록] react babel-jest 호환되지 않는 버전 관련 오류 (0) | 2022.09.11 |