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?
CodePudding user response:
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
CodePudding user response:
have you tried
npm install -g typescript
yes i tryed but still with error
Have you tried
npm run start