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

使用yarn install安装material-ui依赖报错,未生成node_modules

解决Yarn安装Material-UI依赖时的YN0057 glob模式报错

问题现象

执行yarn install搭建Material-UI本地环境时,未生成node_modules文件夹,触发一系列YN0057错误,核心提示为依赖覆盖配置使用了已被移除的glob模式,示例报错:

@mui/monorepo: The override for '/@babel/core' includes a glob pattern. Glob patterns have been removed since their behaviours don't match what you'd expect. Set the override to '@babel/core' instead.
➤ YN0057: │ @mui/monorepo: The override for '/@babel/code-frame' includes a glob pattern. Glob patterns have been removed since their behaviours don't match what you'd expect. Set the override to '@babel/code-frame' instead.

修复步骤

  1. 打开项目根目录的package.json文件
  2. 找到overrides(Yarn 2+)或resolutions(Yarn 1.x)字段
  3. 将所有带glob通配符的依赖项修改为精确包名:
    • 把"/@babel/core"替换为"@babel/core"
    • 把"/@babel/code-frame"替换为"@babel/code-frame"
    • 把"**/@babel/plugin-proposal-class-properties"替换为"@babel/plugin-proposal-class-properties"
  4. 保存文件后重新执行安装命令:
    yarn install
    

额外排查方案

  • 若使用MonoRepo仓库,切换至稳定版本分支,避免开发分支的未成熟配置
  • 缓存导致的异常可尝试清除缓存后重装:
    yarn cache clean
    yarn install
    

内容的提问来源于stack exchange,提问作者Piyush Yadav

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 23:27:02