我想创建一个 React 应用程序,并且想在这个应用程序中使用 typescript,首先我访问了 React 网站,以便使用 typescript 创建一个应用程序,我发现我必须先将此指令放入终端中:
npx create-react-app my-app --template typescript
安装完成后,我将其放入终端:
npm start
但我收到了这个错误:
It looks like you're trying to use TypeScript but do not have typescript installed
我打开终端并写下了这条指令:
npm install
然后我运行该应用程序:
npm start
但错误仍然存在
我该如何解决这个问题?
我按照以下说明解决了我的问题:
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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)