찾아보게된 이유 🧐

‘chakra’ 를 사용하기 위해서

Create React App 설치

npm i @chakra-ui/react @emotion/react@^11 @emotion/styled@^11 framer-motion@^6

명령어 사용 중에 code ERESOLVE 에러 발생

구글링을 해서 내가 해결한 방법을 기록으로 남기려고 한다.


해결 방법 😎

리액트(React)의 버전 충돌이 나서 에러가 발생한것이었다

에러 내용중에 해결 하려면
--force--legacy-peer-deps 사용하려고 되어있는데

👉 --legacy-peer-deps를 사용해본다

기존 명령어 뒤에 --save --legacy-peer-deps 를 사용해서
npm i @chakra-ui/react @emotion/react@^11 @emotion/styled@^11 framer-motion@^6

실행 시켜보면
npm i @chakra-ui/react @emotion/react@^11 @emotion/styled@^11 framer-motion@^6 --save --legacy-peer-deps

정말 에러가 해결되고 install 이 잘 되는걸 볼 수 있다 👆

package.json을 확인해보면 ‘chakra-ui’ 가 install 된걸 확인할 수 있다 👆


발생했던 에러 내용

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable o resolve dependency tree
npm ERR!
npm ERR! While resolving: web3-boilerplate@0.1.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@”^17.0.2” from the root project
npm ERR! peer react@”>=16.8.0” from @emotion/react@11.9.0
npm ERR! node_modules/@emotion/react
npm ERR! @emotion/react@”^11” from the root project
npm ERR! peer @emotion/react@”^11.0.0” from @chakra-ui/react@2.1.2
npm ERR! node_modules/@chakra-ui/react
npm ERR! @chakra-ui/react@”^2.1.2” from the root project
npm ERR! 1 more (@emotion/styled)
npm ERR! 3 more (@emotion/styled, framer-motion, react-dom)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@”>=18” from @chakra-ui/react@2.1.2
npm ERR! node_modules/@chakra-ui/react
npm ERR! @chakra-ui/react@”^2.1.2” from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with –force, or –legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!