node.js - create-react-app my-app redux 与 new react 18.0.0 的错误

标签 node.js reactjs npm react-redux npx

我正在尝试使用 npx 的通用命令创建一个带有 redux 的 React 应用程序,但出现此错误

命令

npx create-react-app myp --template redux

错误

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

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

最佳答案

npx create-react-app redux-ts --template redux-typescript 昨天对我不起作用,但今天它起作用了,再试一次你原来的命令。

关于node.js - create-react-app my-app redux 与 new react 18.0.0 的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71682625/

相关文章:

node.js - 从一年中的周数获取该月的周数

html - 如何使用 Windows 8 编译 Twitter Bootstrap 3.0

javascript - 数据导入 MySQL -> 值与无值

html - 实时服务器未加载 css 文件

javascript - TypeScript 如何在 promise 中导出 const

javascript - 如何将代码移出主 server.js 文件,但在应用程序启动时仍然使用它?

javascript - 如何在 React 组件中每分钟调用一个函数?

reactjs - React useEffect 钩子(Hook)有条件地加载 onsnapshot

javascript - React-chartjs-2 不显示曲线

node.js - npm 安装错误为 errno -2