1
resposta

Erro ao executar o comando npx

Quando tento executar: npx create-react-app alura-studies --template typescript --use-npm

O seguinte erro ocorre:

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: alura-studies@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\lucas.ramos\AppData\Local\npm-cache\_logs\2025-01-28T20_29_58_509Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\lucas.ramos\AppData\Local\npm-cache\_logs\2025-01-28T20_29_58_509Z-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 @types/jest@^27.0.1 @types/node@^16.7.13 @types/react@^18.0.0 @types/react-dom@^18.0.0 typescript@^4.4.2 web-vitals@^2.1.0` failed
1 resposta

Olá, Lucas. Tudo bem?

O que acontece é que recentemente o React atualizou para a v19, e a biblioteca testing-library está conflitando com essa versão, que é o que está causando o erro. Um aluno publicou aqui no fórum um passo a passo que pode te ajudar a contornar esse problema.

Espero ter ajudado!

Siga firme nos seus estudos e conte com o fórum sempre que precisar!

Abraços :)

Caso este post tenha lhe ajudado, por favor, marcar como solucionado