You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行npm install安装MUI依赖时遇ERESOLVE依赖树解析错误求助

解决npm安装MUI依赖时的ERESOLVE依赖树错误

以下是几个实测有效的解决步骤,按顺序尝试即可:

  • 清理npm缓存,清除可能残留的旧依赖信息:
    npm cache clean --force
    
  • 删除项目里的node_modules文件夹和package-lock.json文件(Windows用户用对应命令),彻底重置依赖状态:
    # macOS/Linux
    rm -rf node_modules package-lock.json
    # Windows
    rmdir /s /q node_modules && del package-lock.json
    
    之后重新执行安装命令:
    npm install @mui/material @emotion/react @emotion/styled
    
  • 如果还是报错,添加--legacy-peer-deps参数忽略peer依赖的严格检查(这是解决此类冲突最常用的方案):
    npm install @mui/material @emotion/react @emotion/styled --legacy-peer-deps
    
  • 升级npm到最新版本,旧版本的依赖解析逻辑可能存在缺陷:
    npm install -g npm@latest
    
  • 检查项目是否存在旧版material-ui包(注意是不带@mui前缀的旧包),如果有先卸载再重新安装MUI:
    npm uninstall material-ui
    npm install @mui/material @emotion/react @emotion/styled
    

内容的提问来源于stack exchange,提问作者Arjun R.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 01:12:37