简体   繁体   English

请帮忙,当我尝试在我的 React 项目中安装材料 UI 时遇到问题

[英]Kindly help,am having issues when I try to install material UI in my react project

npm ERR: C.\Users\sammy waweru\AppData\Local\npm-cache_logs\2021-11-19T09_14_33_601Z-debug:log PS C:\Users\sammy waweru\Desktop\challanges\linked-in clone> npm install @mui/material @emotion/react @emotion/styled npm ERR: C.\Users\sammy waweru\AppData\Local\npm-cache_logs\2021-11-19T09_14_33_601Z-debug:log PS C:\Users\sammy waweru\Desktop\challanges\linked-in clone> 8582980 安装/材料@情感/反应@情感/风格

up to date, audited 2099 packages in 41s最新,在 41 秒内审核了 2099 个包

163 packages are looking for funding run npm fund for details 163包正在找资金跑npm fund详情

27 vulnerabilities (16 moderate, 9 high, 2 critical) 27 个漏洞(16 个中等,9 个高,2 个严重)

To address all issues (including breaking changes), run: npm audit fix --force要解决所有问题(包括重大更改),请运行:npm audit fix --force

Run npm audit for details.运行npm audit了解详情。 PS C:\Users\sammy waweru\Desktop\challanges\linked-in clone> npm i -S material-ui npm ERR: code ERESOLVE npm ERR. PS C:\Users\sammy waweru\Desktop\challanges\linked-in clone> npm i -S material-ui npm ERR:代码 ERESOLVE npm ERR。 ERESOLVE unable to resolve dependency tree npm ERR. ERESOLVE 无法解析依赖关系树 npm ERR。 npm ERR: While resolving. npm ERR:解析时。 click-me@0.1.0 npm ERR.点击我@0.1.0 npm 错误。 Found: react@17.0.2 npm ERR.发现:react@17.0.2 npm ERR。 node_modules/react npm ERR.节点模块/反应 npm 错误。 react@"^17.0.2" from the root project npm ERR, npm ERR, Could not resolve dependency.来自根项目的 react@"^17.0.2" npm ERR,npm ERR,无法解析依赖关系。 npm ERR: peer react@"^15.4.0 || ^16.0.0" from material-ui@0.20.2 npm ERR! npm 错误:peer react@"^15.4.0 || ^16.0.0" from material-ui@0.20.2 npm 错误! node_modules/material-ui npm ERR! node_modules/material-ui npm 错误! material-ui@"*" from the root project npm ERR! material-ui@"*" 来自根项目 npm ERR! npm ERR! npm 错误! Fix the upstream dependency conflict, or retry npm ERR!修复上游依赖冲突,或者重试 npm ERR! this command with --force, or --legacy-peer-deps npm ERR!此命令带有 --force 或 --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.接受不正确(并且可能损坏)的依赖项解析。 npm ERR! npm 错误! npm ERR! npm 错误! See C:\Users\sammy waweru\AppData\Local\npm-cache\eresolve-report.txt for a full report.有关完整报告,请参阅 C:\Users\sammy waweru\AppData\Local\npm-cache\eresolve-report.txt。

npm ERR: A complete log of this run can be found in: npm ERR. npm ERR:此运行的完整日志可在以下位置找到:npm ERR。 C:\Users\sammy waweru\AppData\Local\npm-cache_logs\2021-11-19T09_16_16_671Z-debug.log PS C:\Users\sammy waweru\Desktop\challanges\linked-in clone> C:\Users\sammy waweru\AppData\Local\npm-cache_logs\2021-11-19T09_16_16_671Z-debug.log PS C:\Users\sammy waweru\Desktop\challanges\linked-in clone>

install @mui/material without the other depandencies and check if it work在没有其他依赖项的情况下安装 @mui/material 并检查它是否有效

PS C:\Users\sammy waweru\Desktop\challanges\linked-in clone> npm install @material-ui/core added 20 packages, and audited 2119 packages in 4m 167 packages are looking for funding run `npm fund` for details 27 vulnerabilities (16 moderate, 9 high, 2 critical) To address all issues (including breaking changes), run: npm audit fix --force Run `npm audit` for details. PS C:\Users\sammy waweru\Desktop\challanges\linked-in clone> npm install @mui/material up to date, audited 2119 packages in 40s 167 packages are looking for funding run `npm fund` for details 27 vulnerabilities (16 moderate, 9 high, 2 critical) To address all issues (including breaking changes), run: npm audit fix --force Run `npm audit` for details.

Failed to compile./src/HeaderOptions.js Module not found: Can't resolve '@mui/icons-material/Home' in 'C:\Users\sammy waweru\Desktop\challanges\linked-in clone\src' This error occurred during the build time and cannot be dismissed.无法编译。/src/HeaderOptions.js 未找到模块:无法解析 'C:\Users\sammy waweru\Desktop\challanges\linked-in clone\src' 中的 '@mui/icons-material/Home' 这个在构建期间发生错误,无法解除。

this is how my browser is responding这就是我的浏览器的响应方式

You are probably using a react version that doesn't support material ui.您可能正在使用不支持材料 ui 的反应版本。 Try:尝试:

npm i react@latest react-scripts@latest react-dom@latest npm 我 react@latest react-scripts@latest react-dom@latest

then try re-installing material ui然后尝试重新安装材料ui

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM