0

I have tried to generate a react app integrated with type script from the following command.

npx create-react-app my-app --template typescript

And I got the following error in the terminal

Installing template dependencies using npm...
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app@0.1.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"<18.0.0" from @testing-library/react@12.1.5
npm ERR! node_modules/@testing-library/react
npm ERR!   @testing-library/react@"^12.0.0" 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!
npm ERR! See C:\Users\


npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\****\AppData\Local\npm-cache\_logs\2022-04-    12T11_50_29_275Z-debug.log
`npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^12.0.0 @testing-library/user-event@^13.2.1 @types/jest@^27.0.1 @types/node@^16.7.13 @types/react@^17.0.20 @types/react-dom@^17.0.9 typescript@^4.4.2 web-vitals@^2.1.0` failed

The generated application out of this command is not working properley and it has a lot of react features like import .css files inside my .tsx

1 Answers1

1

Seems like there's an ongoing issue with create-react-app and React 18. Until it's fixed see some workarounds here:

create-react-app dependency version issues with React 18