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

Angular Material 14升级至15时MDC迁移脚本执行失败

Angular Material MDC迁移报错:Cannot read properties of undefined (reading 'length')

我按照迁移指南执行了以下命令:

ng generate @angular/material:mdc-migration

执行时的交互及输出如下:

? Limit the migration to a specific directory? (Enter the relative path such as 'src/app/shared' or leave blank for all directories) src/app/shared
? What components do you want to migrate? Button, Card, Checkbox
    Limiting migration to: src/app/shared
    Migrating components:
    button
    card
    checkbox
    Migrating project: dummy-frontend
Cannot read properties of undefined (reading 'length')

临时解决方法

  • 拆分迁移范围,逐个文件夹单独执行该迁移脚本,即可绕过此报错完成组件迁移。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.07 23:25:17