【问题标题】:Angular Library Compilation: ERROR: Cannot read property 'then' of undefinedAngular 库编译:错误:无法读取未定义的属性“then”
【发布时间】:2021-06-12 06:52:20
【问题描述】:

我有一个 Angular 11 工作区,其中包含多个项目(库)。最近我在一个库中添加了一个新组件,编译一切正常。在我的 public-api.ts 文件中公开新组件后,我在编译我的库(使用 ng build my-lib 命令)时遇到了这个单行且无意义的错误:

错误:无法读取未定义的属性“then”

有人遇到过这个问题吗?请帮忙!

public-api.ts 最新变化:

export * from './lib/ray-autocomplete/ray-autocomplete.module';
export * from './lib/ray-autocomplete/ray-autocomplete.component';

【问题讨论】:

    标签: angular compilation angular-library


    【解决方案1】:

    这是我从另一个组件复制新组件时的错;我忘了在@Component 声明处重命名文件:

    @Component({
      selector: 'ray-autocomplete',
      templateUrl: './ray-autocomplete.component.html', 
      styleUrls: ['./ray-autocomplete.component.css'], 
    

    但这个错误非常具有误导性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-08
      • 2014-11-29
      • 1970-01-01
      • 2021-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-13
      相关资源
      最近更新 更多