我可以从Create-React-App中创建打字机模板
我试图从以下命令中生成与类型脚本集成的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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎有一个持续存在的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