为了让自己熟悉Redux的副作用,我尝试使用create-react-app redux模板创建一个项目,但遇到了以下错误:
Installing template dependencies using npm...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app@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 /Users/itsme/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/itsme/.npm/_logs/2022-03-30T07_04_21_133Z-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
我想这个问题可能源于模板,所以我创建了一个普通的create-react-app项目,然后尝试手动安装react-redux,但是得到了同样的错误。运行--force和--legacy-peer-deps命令没有任何效果。我的Node(v16.14.2)和npm(8.5.5)版本是最新的。有人能告诉我这是怎么回事吗?
1条答案
按热度按时间y0u0uwnf1#
第一次写入
然后安装您软件包。