简体   繁体   English

使用typescript工作的create-react-app不起作用

[英]create-react-app with typescript not working

I want to create a typescript react app by using this tool Microsoft/TypeScript-React-Starter . 我想通过使用此工具Microsoft / TypeScript-React-Starter创建一个打字稿反应应用程序。 I have followed the instructions from the github page: 我按照github页面的说明操作:

1. npm install -g create-react-app

2. create-react-app my-app --scripts-version=react-scripts-ts

3. cd my-app

4. npm start

Then I get this error: 然后我收到这个错误:

error TS2304: Cannot find name 'process'

I have uninstalled create-react-app and reinstalled it. 我已经卸载了create-react-app并重新安装了它。 The error persists. 错误仍然存​​在。 By the way yesterday I created a test program with the same tool and it worked. 顺便说一句,昨天我使用相同的工具创建了一个测试程序并且它可以工作。 When I run this test program, it works as expected. 当我运行此测试程序时,它按预期工作。

But whatever application I create today with the tool throws the above exception. 但是我今天使用该工具创建的任何应用程序都会引发上述异常。 I think my installation is corrupted some how. 我认为我的安装有些损坏。

Any help would be greatly appreciated. 任何帮助将不胜感激。

Going back to typescript version 2.3.4 worked for me. 回到打字稿版本2.3.4对我有用。

I used: 我用了:

npm install typescript@2.3.4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM