【问题标题】:Angular 7 CLI ng generate component error: 'Cannot read property 'sourceRoot' of undefined'Angular 7 CLI ng 生成组件错误:'无法读取未定义的属性'sourceRoot'
【发布时间】:2018-11-28 19:55:33
【问题描述】:

当我尝试在 CLI 上运行以下命令时收到以下错误:

ng generate component [component-name]

我不断得到:

Cannot read property 'sourceRoot' of undefined

我猜我是在更新我使用的 Angular 版本后开始获得它的。

查看回复以获取解决方案。

【问题讨论】:

    标签: angular components command-line-interface angular7 generate


    【解决方案1】:

    要解决这个问题,我必须转到我的 Angular.json 文件夹。

    1. 搜索“e2e”
    2. 将“根”从“e2e/”更新为“/”。 该位置在“[项目名称]-e2e”下

    更新后我就可以运行命令了

    ng generate component [component-name]
    

    没有问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-21
      • 1970-01-01
      • 2019-11-01
      • 2017-09-13
      • 2018-12-20
      • 2018-06-28
      • 1970-01-01
      • 2023-01-15
      相关资源
      最近更新 更多