npm ERR!代码ERESOLVE npm ERR!ERESOLVE无法解析React中的相关性树

5lwkijsr  于 2022-11-30  发布在  React
关注(0)|答案(3)|浏览(267)

我正在做一个mern项目,因为我使用了以下命令

NPM iReact-路由器-dom axiosReact-贝宝-快递-结帐

在这一点上,我遇到了以下错误

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: client@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@"~0.14.8 || ^15.5.0" from react-paypal-express-checkout@1.0.5
npm ERR! node_modules/react-paypal-express-checkout
npm ERR!   react-paypal-express-checkout@"*" 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\nahee\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\nahee\AppData\Local\npm-cache\_logs\2022-04-11T15_43_33_096Z-debug.log

我的package.json文件是:

{
  "name": "animal_feedmart",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcrypt": "^5.0.0",
    "cloudinary": "^1.23.0",
    "concurrently": "^5.3.0",
    "cookie-parser": "^1.4.5",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-fileupload": "^1.2.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.10.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.4"
  }
}

有谁能帮我清除这个错误。
先谢了

iibxawm4

iibxawm41#

我也遇到过类似的问题,但是错误出现在npx create-react-app之后。我找到了一个解决方案,你需要输入npm config set legacy-peer-deps true。但是我不知道这个命令是否对你有帮助

brgchamk

brgchamk2#

npm i react-router-dom --force

npm i anylibirary --legacy-peer-deps
vfh0ocws

vfh0ocws3#

npm错误!代码ERESOLVE
npm错误!ERESOLVE无法解析相关性树
npm错误!
npm错误!解析时:客户端@0.1.0
npm错误!找到:18.0.0时的React
npm错误!节点模块/React
npm错误!从根项目React@"^18.0.0”
npm错误!
npm错误!无法解析相关性:
npm错误!对等端React@"~0.14.8|| ^15.5.0”来自react-paypal-express-checkout@1.0.5的内容
npm ERR!节点模块/React-贝宝-快速-结帐
npm错误!react-paypal-express-checkout@"*”来自根项目
npm错误!
npm错误!请修复上游依赖项冲突,或重试
npm错误!将此命令与--force或--legacy-peer-deps一起使用
npm ERR!无法接受不正确的(可能已损坏的)依赖关系解析。
npm错误!
npm错误!有关完整报告,请参阅C:\用户\nahee\应用程序数据\本地\npm-cache\eresolve-report.txt。
npm ERR!可以在以下位置找到此运行的完整日志:
系统提示:如果您的系统发生了错误,请登录!
如果你曾经遇到过这个问题
那你就得

npm安装示例--强制

在示例位置安装任何您想要安装的内容

相关问题