fe前端执行npm install失败

Viewed 29

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving:
npm ERR! Found:
npm ERR! node_modules/react
npm ERR! react@"^17.0.0" from the root project
npm ERR! peer react@">=16.8.4" from @ant-design/graphs@1.3.6
npm ERR! node_modules/@ant-design/graphs
npm ERR! @ant-design/graphs@"^1.3.6" from the root project
npm ERR! 62 more (@ant-design/icons, @ant-design/plots, @icons/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0" from
npm ERR! node_modules/react-ace
npm ERR! react-ace@"^8.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency:
npm ERR! node_modules/react
npm ERR! peer react@"^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0" from
npm ERR! node_modules/react-ace
npm ERR! react-ace@"^8.1.0" 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!

3 Answers

执行npm i --legacy-peer-deps

试了也还是不行

先删除node_mouldes,执行npm cache clean -f,再执行npm i --legacy-peer-deps

➜  fe git:(main) ✗ npm i --legacy-peer-deps --registry=https://registry.npmjs.org
npm WARN deprecated @codemirror/stream-parser@0.19.9: As of 0.20.0, this package has been merged into @codemirror/language
npm WARN deprecated lezer@0.13.5: This package has been replaced by @lezer/lr
npm WARN deprecated lezer-tree@0.13.2: This package has been replaced by @lezer/common

added 738 packages, and audited 739 packages in 32s

122 packages are looking for funding
  run `npm fund` for details

16 vulnerabilities (15 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
➜  fe git:(main) ✗ npm -v                                                        
8.11.0
➜  fe git:(main) ✗