我可以从Create-React-App中创建打字机模板

发布于 2025-01-20 17:12:35 字数 1695 浏览 0 评论 0原文

我试图从以下命令中生成与类型脚本集成的React应用程序。

npx create-react-app my-app --template typescript

而且我在终端中收到以下错误。

Installing template dependencies using npm...
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"<18.0.0" from @testing-library/[email protected]
npm ERR! node_modules/@testing-library/react
npm ERR!   @testing-library/react@"^12.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\


npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\****\AppData\Local\npm-cache\_logs\2022-04-    12T11_50_29_275Z-debug.log
`npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^12.0.0 @testing-library/user-event@^13.2.1 @types/jest@^27.0.1 @types/node@^16.7.13 @types/react@^17.0.20 @types/react-dom@^17.0.9 typescript@^4.4.2 web-vitals@^2.1.0` failed

该命令中生成的应用程序不起作用,并且它具有许多React功能,例如My .TSX中的Import .CSS文件

I have tried to generate a react app integrated with type script from the following command.

npx create-react-app my-app --template typescript

And I got the following error in the terminal

Installing template dependencies using npm...
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"<18.0.0" from @testing-library/[email protected]
npm ERR! node_modules/@testing-library/react
npm ERR!   @testing-library/react@"^12.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\


npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\****\AppData\Local\npm-cache\_logs\2022-04-    12T11_50_29_275Z-debug.log
`npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^12.0.0 @testing-library/user-event@^13.2.1 @types/jest@^27.0.1 @types/node@^16.7.13 @types/react@^17.0.20 @types/react-dom@^17.0.9 typescript@^4.4.2 web-vitals@^2.1.0` failed

The generated application out of this command is not working properley and it has a lot of react features like import .css files inside my .tsx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与往事干杯 2025-01-27 17:12:35

似乎有一个持续存在的create-react-app和React 18

。 -sissues-with-with-react-18“> react 18 的create-react-app依赖版本问题

Seems like there's an ongoing issue with create-react-app and React 18. Until it's fixed see some workarounds here:

create-react-app dependency version issues with React 18

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文