尝试通过以下方式将 TypeScript 添加到已创建的 React 应用程序:https : //create-react-app.dev/docs/adding-typescript
当我尝试启动时,我做了所有事情,但出现以下错误:
> npx react-scripts start
Could not find a required file.
Name: index.js
Searched in: /home/karl/dev/afry/tmr-client/src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tmr-client@0.1.0 start: `npx react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tmr-client@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/karl/.npm/_logs/2020-11-06T18_43_02_622Z-debug.log
我按照指南中的说明将 index.js 重命名为 index.ts。