작성
·
196
·
수정됨
1
뭔가 잘 모르겠는데.. 아래 확인 부탁드려도 될까요?
설정한것도 없는것 같은데 기본 생성 명령어자체가 실행이 안된다니..ㅠㅠㅠㅠ
manijang2@gimseonman-ui-MacBookAir VSProjects % npx create-react-app cra-react-app
Creating a new React app in /Users/manijang2/VSProjects/cra-react-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
added 1324 packages in 40s
268 packages are looking for funding
run `npm fund` for details
Initialized a git repository.
Installing template dependencies using npm...
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: cra-react-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 /Users/manijang2/.npm/_logs/2025-02-03T13_23_36_276Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/manijang2/.npm/_logs/2025-02-03T13_23_36_276Z-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
manijang2@gimseonman-ui-MacBookAir VSProjects %
답변 3
0
안녕하세요 🙂
이 에러는 React 버전 충돌로 인해 발생한오류로
https://github.com/facebook/react/issues/32016 깃헙에서도 다루고 있는데요.
아래와 같이 버전을 낮춰 진행하시면 됩니다.
npx create-react-app my-app
cd my-app
npm install react@18 react-dom@18 react-scripts web-vitals
npm run start
0
안녕하세요, 인프런 AI 인턴입니다. 김선만님, React 애플리케이션 생성을 시도할 때 발생하는 에러에 대한 해결책을 안내해 드리겠습니다.
해당 에러는 주로 패키지 간의 의존성 충돌 때문에 발생합니다. 특히, react
버전과 @testing-library/react
가 서로 호환되지 않는 버전을 사용하고 있어서 발생한 것으로 보입니다.
해결 방법은 다음과 같습니다:
패키지 충돌 해결: npx create-react-app
명령어에 --legacy-peer-deps
옵션을 추가하여 의존성 문제를 무시하도록 지시할 수 있습니다.
npx create-react-app cra-react-app --legacy-peer-deps
강제 설치 시도: 만약 위 방법이 작동하지 않는다면 --force
옵션을 사용해서 다시 시도해 볼 수 있습니다.
npx create-react-app cra-react-app --force
이러한 옵션은 의존성 관련 경고를 무시하며 설치를 진행하기 때문에 경우에 따라 모든 기능이 완벽히 작동하지 않을 수 있습니다. 이러한 경우, 설치 중 추가로 볼 수 있는 로그를 함께 확인하여 필요한 부분을 직접 수정해야 할 수도 있습니다.
더불어, 아래는 유사한 문제가 해결된 적 있는 게시물의 자료입니다. 참고해 보시면 도움이 될 수 있습니다:
- npm Error 해결 방법
- React 프로젝트 생성 중 에러 해결
저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.
nodejs 버전이 혹시 너무 낮은건 아닌지 확인해보시겠어요?
강의시 버전은
nodejs v20.11.1
npm v10.2.4
입니다~!