본문 바로가기
React

React@19 프로젝트 시작 문제

by Byeong 2025. 2. 5.

공모전 프로젝트에서 프런트엔드를 React로 개발하기 위해 설치를 진행했는데, 의존성 문제로 오류가 발생했다.

문제  

Installing template dependencies using npm...
code ERESOLVE
ERESOLVE unable to resolve dependency tree

While resolving: my-app@0.1.0
Found: react@19.0.0
node_modules/react
react@"^19.0.0" from the root project

Could not resolve dependency:
peer react@"^18.0.0" from @testing-library/react@13.4.0
node_modules/@testing-library/react
@testing-library/react@"^13.0.0" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

For a full report see:
/Users/.npm/_logs/2025-02-04T15_44_02_631Z-eresolve-report.txt
A complete log of this run can be found in: /Users/.npm/_logs/2025-02-04T15_44_02_631Z-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

 

이 오류는 React 19와 @testing-library/react@13.4.0의 버전 충돌로 인해 발생했다.

  • React 19는 최신 버전이지만, @testing-library/react@13.4.0은 React 18까지만 지원한다.
  • 따라서 npm이 의존성 문제를 해결하지 못하고 설치를 중단한 것이다.

해결방법 : Yarn

npm install -g yarn # Yarn 설치
yarn create react-app my-app

 

yarn을 사용하면 의존성 문제를 자동으로 해결해 준다. 이외에도  React 18로 다운그레이드 방법과 강제로 의존성을 무시하고 설치하는 방법이 있지만 Yarn을 이용하는 방법이 가장 쉽고 빠르게 문제를 해결할 수 있었다.


마무리 

 현재 진행 중인 공모전에서는 FastAPI도 함께 적용하고 있다.최근 블로그 글 작성을 소홀히 했지만, 앞으로 시간이 날 때 FastAPI를 활용한 프로젝트 내용을 정리해서 올려야겠다.