'React Typescript: It looks like you're trying to use TypeScript but do not have typescript installed

I want to create a React application and I want to use a typescript in this application, at first I went to the React website in order to create an application using typescript and I found that I had to put this instruction in the terminal first:

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

And when it finished installing, I put it in the terminal:

npm start

But I got this error:

It looks like you're trying to use TypeScript but do not have typescript installed

I opened the terminal and wrote this instruction:

npm install

then i run the app:

npm start 

But the error is still there

How can I solve the problem?



Solution 1:[1]

I solved my problem with the following instruction:

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

or

yarn add typescript @types/node @types/react @types/react-dom @types/jest

Solution 2:[2]

have you tried

npm install -g typescript

yes i tryed but still with error

Have you tried

npm run start

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2