angular 5 Expected 0 arguments, but got 1

Jeya Balaji picture Jeya Balaji · Mar 6, 2018 · Viewed 8.3k times · Source

I have a jhipster project. It is running fine in dev mode. When I try to build in production mode (using the cmd "mvnw -Pprod"), I am getting the error :

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.

All the 4 errors point to line 1, which is empty.

In order to find the actual line number, I tried following cmd (found in so).

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

Got the same error.

How do I find the error line number? Is there any debug option available in mvnw to display more info? How to resolve this error?

Answer

windmaomao picture windmaomao · Mar 6, 2018

Okay, if you are using tree shaking, ex. with --aot, especially at build time, it'll check the functions in your templates.

This error states that in your template template.component.html, it calls a function with no arguments, but instead you put one after that, ex. open(true)

You should be able to find the source code. It should sit inside src\main\webapp\app\entities\ext-task\ext-task-group-list\ext-task-group-list.component.html, search for any function called inside this template.