与新React 18.0.0的Create-React-App My-App Redux发生错误

发布于 2025-01-17 21:49:26 字数 1679 浏览 0 评论 0原文

我正在尝试使用 npx 的常规命令使用 redux 创建一个 React 应用程序,但收到此错误

command

npx create-react-app myp --template redux

error

Installing template dependencies using npm...
npm ERR! code ERESOLVE
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@"^16.8.3 || ^17" from [email protected]
npm ERR! node_modules/react-redux
npm ERR!   react-redux@"^7.2.3" 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\rickb\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\rickb\AppData\Local\npm-cache\_logs\2022-03-30T18_49_41_783Z-debug-0.log
`npm install --no-audit --save @reduxjs/toolkit@^1.5.1 @testing-library/jest-dom@^4.2.4 @testing-library/react@^9.3.2 @testing-library/user-event@^7.1.2 react-redux@^7.2.3` failed

我应该怎么做才能删除此错误?

I am trying to create a react app with redux with the general command of npx and I am getting this error

command

npx create-react-app myp --template redux

error

Installing template dependencies using npm...
npm ERR! code ERESOLVE
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@"^16.8.3 || ^17" from [email protected]
npm ERR! node_modules/react-redux
npm ERR!   react-redux@"^7.2.3" 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\rickb\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\rickb\AppData\Local\npm-cache\_logs\2022-03-30T18_49_41_783Z-debug-0.log
`npm install --no-audit --save @reduxjs/toolkit@^1.5.1 @testing-library/jest-dom@^4.2.4 @testing-library/react@^9.3.2 @testing-library/user-event@^7.1.2 react-redux@^7.2.3` failed

What should I do to remove this error??

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

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

发布评论

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

评论(2

亚希 2025-01-24 21:49:26

npx create-react-app redux-ts -template redux-typecript昨天对我不起作用,但是今天它正在使用,请重试您的原始命令。

npx create-react-app redux-ts --template redux-typescript wasn't working for me yesterday but it's working today, give your original command a try again.

又爬满兰若 2025-01-24 21:49:26

这是一个新的错误,实际上,您唯一的解决方案就是将React-Redux与纱线添加。

纱线添加react-redux

注意:我建议暂时将您的React降级到版本17,因为React V18不支持Redux Toolkit和其他库。最后,我正在使用Redux Saga,并且有V18的问题。

It's a new error, and realistically your only solution is to just add react-redux with Yarn.

yarn add react-redux

Note: I suggest downgrading your React to version 17 for the time being, Since React v18 is not supporting Redux Toolkit and other Libraries. On my end I am using Redux saga and it is having issues with v18.

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