【问题标题】:angular 5 Expected 0 arguments, but got 1角度 5 预期 0 个参数,但得到 1
【发布时间】:2018-08-14 07:40:47
【问题描述】:

我有一个 jhipster 项目。它在开发模式下运行良好。当我尝试在生产模式下构建(使用 cmd“mvnw -Pprod”)时,我收到了错误:

错误 src\main\webapp\app\entities\ext-task\ext-task-group-list\ext-task-group-list.component.html(1,457): :预期 0 个参数,但得到 1 个。 src\main\webapp\app\entities\ext-task\ext-task-group-list\ext-task-group-list.component.html(1,665): :预期 0 个参数,但得到 1 个。 src\main\webapp\app\entities\ext-task\ext-task-list-template\ext-task-list-template.component.html(1,302): :预期 0 个参数,但得到 1 个。 src\main\webapp\app\entities\ext-task\ext-task-list-template\ext-task-list-template.component.html(1,505): : 预期 0 个参数,但得到 1 个。

所有 4 个错误都指向第 1 行,该行是空的。

为了找到实际的行号,我尝试了以下cmd(在so中找到)。

yarn run cleanup && yarn run webpack:prod:main && yarn run clean-www

遇到同样的错误。

如何找到错误行号? mvnw 中是否有可用的调试选项来显示更多信息?如何解决这个错误?

【问题讨论】:

  • 错误指向第 1 行,但列号 457 非常大,所以我怀疑您的整个文件被视为单行,可能是行尾编码有问题。

标签: angular jhipster


【解决方案1】:

好的,如果您正在使用摇树,例如。使用--aot,尤其是在构建时,它会检查模板中的功能。

此错误表明在您的模板template.component.html 中,它调用了一个没有参数的函数,但是您在其后放置了一个,例如。 open(true)

您应该能够找到源代码。它应该位于src\main\webapp\app\entities\ext-task\ext-task-group-list\ext-task-group-list.component.html 中,搜索此模板中调用的任何函数。

【讨论】:

  • 谢谢,凭直觉检查代码有助于解决问题。
猜你喜欢
  • 1970-01-01
  • 2020-11-07
  • 1970-01-01
  • 1970-01-01
  • 2022-01-24
  • 1970-01-01
  • 1970-01-01
  • 2023-03-22
  • 2021-07-29
相关资源
最近更新 更多