我正试图用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: myp@0.1.0
npm ERR! Found: react@18.0.0
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 react-redux@7.2.6
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

我应该怎么做才能消除这个错误??

推荐答案

这是一个新的错误,实际上,你唯一的解决办法就是用Yarn 添加react redux.

yarn add react-redux

注意:我建议暂时将React降级到版本17,因为React v18不支持Redux Toolkit和其他库.在我这方面,我使用的是Redux saga,它在v18上有问题.

Node.js相关问答推荐

在渲染上部署Node.js服务器时出错:MODULE_NOT_FOUND

需要关于基于角色授权的设计建议

在我的Next.js应用程序中没有正确设置Process.env.NODE_ENV

MongoDB-如何验证Document字段以仅允许特定的文件扩展名?

请求正文未定义

验证器功能在mongoose 中不起作用

找不到 vue-template-compiler@2.6.14 的匹配版本 | Shopware 6.5 更新后的 node 问题

合并Shift对象数组以创建最终的排班表

如何使用mongoose引用不在项目中的模型

无法通过 NextJS 访问 HTTP 帖子中的正文

NodeJS `request` 库无法通过 multipart-form-data 将文件发布到 dotnet 服务器

如何从动态Typescript 文件加载模块

使用 create-expo-app 时如何更改 webpack-config.js 中的哈希函数?

将已保存的卡片从条带显示到前端

为什么 req.params.id 返回 undefined未定义?

适用于 Windows 的 NVM 无法正常工作?

Node.js + Express:应用程序不会开始监听端口 80

MongoDB Node findone如何处理没有结果?

我可以有条件地将 where() 子句添加到我的 knex 查询吗?

什么是 JavaScript 中的REPL?