我正在嘗試按照主頁上的說明安裝材料 UI,但出現依賴樹錯誤:
C:\dev\shape-shop-front-end>npm install @mui/material
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^16.13.1" from the root project
npm ERR! peer react@">=16.8.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/react
npm ERR! node_modules/@mui/material
npm ERR! @mui/material@"*" from the root project
npm ERR!
在我的package.json我有"react": "^16.13.1"。
據我了解,這個錯誤是說 MUI 包需要反應 16.8.0
uj5u.com熱心網友回復:
實際上,它的一個子依賴項@emotion/[email protected] 列出了您必須滿足的以下對等依賴項:
"peerDependencies": {
"@babel/core": "^7.0.0",
"react": ">=16.8.0"
}
來源:https : //github.com/emotion-js/emotion/blob/main/packages/react/package.json
我認為這與新版本的 NPM 如何處理對等依賴項有關:https : //github.blog/2021-02-02-npm-7-is-now-generally-available/
由于您的反應版本似乎沒問題,我會接受這個建議:
您可以選擇使用 --force 重試以繞過沖突或使用 --legacy-peer-deps 命令完全忽略對等依賴項(此行為類似于版本 4-6)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/405711.html
標籤:
上一篇:為什么npm安裝會減少依賴版本
