본문 바로가기
Programming 개발은 구글로/Web[프론트엔드&백엔드]

[React] React 에러 처리 - unable to resolve dependency tree

by 40대직장인 2022. 8. 5.

React 에러 처리

unable to resolve dependency tree 

 

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: #################
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"^18.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR!   @material-ui/core@"^4.11.0" from the root project

 

발생원인

: React 나 React-Dom의 버전이 v18 환경이거나 설치하려는 라이브러리 버전이 package.json 파일에 설정된 버전보다 높으면 발생이 됩니다.

 

해결 방법

: 아래의 명령어들을 이용해서 설치를 해주시면 됩니다.

 

--legacy-peer-deps :  기존 버전 다 무시하고 일단 설치.

--force : package-lock.json에 몇가지의 다른 의존 버전들을 추가하면서 설치.

 

npm install react@^17.0.1 react-dom@17.0.1 --legacy-peer-deps

or

npm install --force

 

 

댓글