我有一个 jhipster 项目。它在开发模式下运行良好。当我尝试在生产模式下构建时(使用命令“mvnw -Pprod”),出现错误:
ERROR in src\main\webapp\app\entities\ext-task\ext-task-group-list\ext-task-group-list.component.html(1,457): : Expected 0 arguments, but got 1. src\main\webapp\app\entities\ext-task\ext-task-group-list\ext-task-group-list.component.html(1,665): : Expected 0 arguments, but got 1. src\main\webapp\app\entities\ext-task\ext-task-list-template\ext-task-list-template.component.html(1,302): : Expected 0 arguments, but got 1. src\main\webapp\app\entities\ext-task\ext-task-list-template\ext-task-list-template.component.html(1,505): : Expected 0 arguments, but got 1.
所有 4 个错误都指向第 1 行,该行是空的。
为了找到实际的行号,我尝试了以下 cmd(在 so 中找到)。
yarn run cleanup && yarn run webpack:prod:main && yarn run clean-www
同样的错误。
如何找到错误行号? mvnw 中是否有可用的调试选项来显示更多信息?如何解决这个错误?
最佳答案
好的,如果你正在使用 tree shaking,例如。使用 --aot
,尤其是在构建时,它会检查模板中的函数。
此错误表明在您的模板 template.component.html
中,它调用了一个不带参数的函数,但您在其后放置了一个函数,例如。 打开(真)
您应该能够找到源代码。它应该位于 src\main\webapp\app\entities\ext-task\ext-task-group-list\ext-task-group-list.component.html
中,搜索任何调用的函数在此模板内。
关于angular 5 预期有 0 个参数,但得到 1 个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49130988/