skip to Main Content

I’m having an issue trying to use create-react-app with the typescript template, although it was working in the past. When trying to use create-react-app with no template i.e JSX, it sets up perfectly. I can’t figure out what’s going on.

Here is what I’m getting:

PS E:GADReact-Basics-CoursesGadReact_ProjectsReact_Typescript> npx create-react-app my-typescript-project --template typescript


Creating a new React app in E:GADReact-Basics-CoursesGadReact_ProjectsReact_Typescriptmy-typescript-project.      

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...


added 1455 packages in 4m

241 packages are looking for funding  run `npm fund` for details        

Installing template dependencies using npm...
`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
PS E:GADReact-Basics-CoursesGadReact_ProjectsReact_Typescript>

I have tried updating npm, node, and tsc, but I’m still getting the same error.

2

Answers


  1. Try this command:

    npm config set legacy-peer-deps true
    

    Then retry your npx create-react-app command.

    Login or Signup to reply.
  2. Try running
    npm cache clean --force
    to clear the npm cache and then run the create-react-app command again.

    If it’s still not working, you can try creating the app without the template and adding TypeScript manually later:

    npx create-react-app my-typescript-project

    cd my-typescript-project

    npm install --save typescript @types/node @types/react @types/react-dom

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search