我正在研究這個 React 專案,從一開始我就得到了這些,但我忽略了它們并習慣于npm i package_name -f
安裝并且肯定會執行此命令來完成作業,但我想知道是什么導致了問題,我想知道如何解決所有這些問題。請不要建議這樣做npm audit fix --force
,我已經這樣做了。
以下是我得到的錯誤:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@">=16.8.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/react
npm ERR! peer @emotion/react@"^11.0.0-rc.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/styled
npm ERR! peerOptional @emotion/styled@"^11.3.0" from
@mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! peer @mui/material@"^5.0.0" from @mui/[email protected]
npm ERR! node_modules/@mui/icons-material
npm ERR! 1 more (the root project)
npm ERR! 3 more (@mui/styled-engine, @mui/system, the root project)
npm ERR! peerOptional @emotion/react@"^11.5.0" from @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! peer @mui/material@"^5.0.0" from @mui/[email protected]
npm ERR! node_modules/@mui/icons-material
npm ERR! @mui/icons-material@"^5.10.2" from the root project
npm ERR! 1 more (the root project)
npm ERR! 3 more (@mui/styled-engine, @mui/system, the root project)
npm ERR! peer react@">=16.8.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/styled
npm ERR! peerOptional @emotion/styled@"^11.3.0" from @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! peer @mui/material@"^5.0.0" from @mui/[email protected]
npm ERR! node_modules/@mui/icons-material
npm ERR! @mui/icons-material@"^5.10.2" from the root project
npm ERR! 1 more (the root project)
npm ERR! peerOptional @emotion/styled@"^11.3.0" from @mui/[email protected]
npm ERR! node_modules/@mui/styled-engine
npm ERR! @mui/styled-engine@"^5.10.2" from @mui/[email protected]
npm ERR! node_modules/@mui/system
npm ERR! @mui/system@"^5.10.2" from @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! 2 more (@mui/system, the root project)
npm ERR! 15 more (@mui/base, @mui/icons-material, @mui/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-currency-format
npm ERR! react-currency-format@"^1.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-currency-format
npm ERR! react-currency-format@"^1.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! See C:\Users\naveen\AppData\Local\npm-cache\eresolve-report.txt for a full report.
uj5u.com熱心網友回復:
npm ERR! While resolving: react-currency-format@1.1.0
npm ERR! Found: react@18.2.0
這表示您使用的是react
v18.2.0。問題是由react-currency-format
Could not resolve dependency:
npm ERR! peer react@"^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0 || ^17.0.0" from react-currency-format@1.1.0
npm ERR! node_modules/react-currency-format
npm ERR! react-currency-format@"^1.1.0" from the root project
此錯誤訊息說react-currency-format
v1.1.0 僅依賴于react
v15 或 v16 或 v17。react
所以這個版本不支持v18 of 。
要解決此問題,請降級react
到 v17 或獲取react-currency-format
支持react
v18 的版本(如果存在)
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/507915.html