reactjs 如何使用TypeScript为React 16.x.x版本使用React-react-app?

egdjgwm8  于 5个月前  发布在  React
关注(0)|答案(2)|浏览(37)

我需要运行一个沙盒React应用程序,版本为16和typescript。
有没有人知道如何做到这一点,因为npx create-react-app --template=typescript blah现在使用React 17?

  • 更新 *

正如我试图安装的评论中所建议的那样:
npm init react-app migration-calculator-npm-demo --scripts-version 3.4.4

npm init react-app migration-calculator-npm-demo --template typescript --scripts-version 3.4.4
3.4.4看起来像是主要更新之前的最后一个react-scripts版本。
不幸的是,我得到的错误与两者。
internal/modules/cjs/loader.js:1088
throw err; ^
错误:无法找到模块“Cannot find”

internal/modules/cjs/loader.js:1088
throw err; ^
错误:无法找到模块“Cannot find”

slsn1g29

slsn1g291#

npx create-react-app blah使用您安装的版本。如果您安装了react包版本16,则它将使用版本16。您也可以运行特定的react脚本版本:示例:sudo npm init react-app my-app --scripts-version 3.4.0Source

hi3rlvi2

hi3rlvi22#

我认为这将有助于你使用typescript创建react应用程序。

npx create-react-app my-app --scripts-version 16.XX.XX --template  typescript

字符串

相关问题