【问题标题】:Angular Build Error - Injectable calls 'emake decorator'Angular Build Error - Injectable 调用“emake 装饰器”
【发布时间】:2019-12-21 10:29:55
【问题描述】:

当我尝试在生产模式下构建我的 Angular (8.2.2) 应用程序时,它会引发以下错误:

ERROR in Error during template compile of 'Compiler'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'Injectable'
    'Injectable' calls 'ɵmakeDecorator'.

我已经尝试返回我知道以前可以运行的代码版本,但由于某种原因,它们都抛出了这个错误。它发生在我的开发机器和 CircleCI 上,因此它似乎无法通过删除 node_modules 和包锁来修复。

我似乎无法在网上找到有关此特定错误的任何信息,因为大多数类似的错误都与 Angular 库有关。非常感谢任何帮助

【问题讨论】:

  • 在您的项目中搜索 @Injectable 装饰器。您是否有任何复杂的 @Injectable 装饰器要向其中传递值?
  • @Noremac 我所有的 @Injectable 装饰器要么是标准的 @Injectable({ providedIn: 'root' }) 要么只是 @Injectable()
  • U 可能是从基类派生的,并在 base.service.ts 上留下了 @Injectable 装饰器
  • @Sagat,我确实有一个基础服务,它也是可注入的,但在过去的 8 个月里一直没有问题。 Angular 中的某些内容最近是否发生了更改,不再允许这样做?

标签: angular build angular-cli circleci


【解决方案1】:

所以我最终自己解决了这个问题。

我在 Angular 项目中使用的一个自己的 typescript 库偶然有一堆 Angular 依赖项。不知道他们是如何到达那里的,但从 package.json 文件中删除它们解决了这个问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-08
    • 1970-01-01
    • 2020-06-08
    • 2018-10-22
    • 2022-11-14
    • 1970-01-01
    • 2021-11-14
    相关资源
    最近更新 更多