작성자 없음
작성자 정보가 삭제된 글입니다.
작성
·
252
0
create-react-app my app 실행 시 아래와 같은 에러가 뜹니다.
Installing template dependencies using npm...
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: my-app@0.1.0
npm error Found: react@19.0.0
npm error node_modules/react
npm error react@"^19.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^18.0.0" from @testing-library/react@13.4.0
npm error node_modules/@testing-library/react
npm error @testing-library/react@"^13.0.0" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\Users\phhyu\AppData\Local\npm-cache\_logs\2025-01-06T07_30_45_069Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\phhyu\AppData\Local\npm-cache\_logs\2025-01-06T07_30_45_069Z-debug-0.log
npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^13.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0
failed
답변 2
1
react@19.0.0 가 @testing-library/react@13.4.0 와 호환성 충돌하는 이슈가 있습니다.
이 오류가 수정되기 전까지는 안될것 같습니다. (create-react-app 지원 중단이라..)
다른 대안으로 yarn 으로 설치 방법과, vite 빌드 도구로 설치하는 방법을 사용하세요.
npm i -g yarn
yarn create react-app <프로젝트 이름>
cd <프로젝트 이름>
yarn start
npx create-vite@latest <프로젝트-이름> --template react
cd <프로젝트-이름>
npm install
npm run dev
0
안녕하세요, 인프런 AI 인턴입니다. 박현님께서 언급하신 에러는 주로 의존성 충돌로 인해 발생합니다. 이 문제는 종종 리액트 버전과 해당 라이브러리 버전 간의 불일치로 인해 발생하는데요.
에러 개요:
- npm
의 의존성 관리에서 발생하는 ERESOLVE 오류로, 설치하려는 특정 패키지가 다른 버전의 의존성을 요구할 때 발생합니다.
- 이 경우 react@19.0.0
과 @testing-library/react@13.4.0
사이에 충돌이 발생한 것입니다.
해결 방법:
1. –legacy-peer-deps 플래그 사용:
- 이 플래그를 사용하여 패키지를 설치하면, 기존 의존성 관계를 무시하고 설치를 진행할 수 있습니다.
- 명령어: npm install --legacy-peer-deps
–force 플래그 사용:
npm install --force
리액트 버전 확인 및 조정:
react
의 버전을 조정하여 다른 패키지들과의 호환성을 유지할 수 있습니다.관련하여 유사한 문제에 대한 해답을 제공한 링크는 다음과 같습니다:
- React 설치 에러 해결 방법
해당 링크에서는 @tensorflow/tfjs-node의 설치 에러 및 해결 방법에 대한 논의가 있었습니다. 비슷한 방식으로, 의존성 관련 문제를 해결하기 위해 패키지를 강제로 설치하는 옵션을 활용할 수 있습니다.
저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.