angular-cli: New version of cli `ng build --prod` gives error.
Bug Report
- [X] bug report
- [ ] feature request
Versions.
Output from: ng --version
.
@angular/cli: 1.0.0-rc.2
node: 7.6.0
os: linux x64
@angular/cli: 1.0.0-rc.2
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
Repro steps.
Nothing changed. Problem is happening after upgrading CLI version to rc.2.
I read the issue https://github.com/angular/angular-cli/issues/5623 , but it is closed without any solution. It is nearly impossible to change all properties to public, because project is too big.
I tried to change, but I gave up now.
Strange thing is build on Github through Codeship is succeed. How is it possible? And why not on local?
The log given by the failure.
ERROR in /home/rango/Desktop/test/accepter/ng-reason/src/$$_gendir/app/components/home/home.component.ngfactory.ts (1038,49): Property 'test_detail_mode' is private and only accessible within class 'HomeComponent'.
/home/rango/Desktop/test/accepter/ng-reason/src/$$_gendir/app/components/home/home.component.ngfactory.ts (1041,44): Property 'test_detail_mode' is private and only accessible within class 'HomeComponent'.
ERROR in /home/rango/Desktop/test/accepter/ng-reason/src/$$_gendir/app/components/reason/reason.component.ngfactory.ts (1230,44): Property 'hours' is private and only accessible within class 'ReasonComponent'.
/home/rango/Desktop/test/accepter/ng-reason/src/$$_gendir/app/components/reason/reason.component.ngfactory.ts (1234,50): Property 'statistic' is private and only accessible within class 'ReasonComponent'.
... ... ...
Desired functionality.
Is there anyway to upgrade codebase without changing all issues by manually?
Migrating all issues line by line is too pain for us, also creating getter, setter
is same for us.
Mention any other details that might be useful.
I think if this error is too critical then CLI should gives error on ng serve or ng build.
Thank you very much.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 20
- Comments: 38 (1 by maintainers)
why ng serve and ng build (without --prod option) are OK !!!
I am having issues with
ng build
andng serve
when AOT is enabled.The errors are along the lines of:
$$_gendir/node_modules/.../XYZ.ngfactory.ts (1,1): Cannot find module 'XYZ'.
and
Typescript compiles cleanly, I have looked at the “don’ts” page. It also works perfectly in either build or serve with
--aot false
.A lot of other people seem to be having similar issues: https://github.com/angular/angular-cli/issues/6020 https://github.com/angular/angular-cli/issues/6013 https://github.com/angular/angular-cli/issues/5802 https://github.com/angular/angular-cli/issues/5779 https://github.com/angular/angular-cli/issues/5765
If we could get a better error message, or have the option of saving the files somewhere to inspect maybe it would be a little less opaque.
@ginkosen
Check
TerminalListComponent
, then you can see this kind of issue.As you can see Supplied parameters do not match any signature of call target.
I think the main problem here is not that the build breaks but the fact that we get no info about where it breaks. My error was in some package I was using. Tracking that down is just a big PITA.
Hi, I had the same issue. It’s related to AoT. Follow this tips to get everything working again: https://github.com/qdouble/angular-webpack2-starter#aot--donts
We have fixed all private methods and variables that were called from html and now it builds perfect.
On May 16, 2017 1:42 PM, “Ian Sam Mungai” notifications@github.com wrote:
Hi, I had the same issue when running ng build --aot --prod -sm false.
TerminalListComponent.ngfactory.ts (10181,35): Supplied parameters do not match any signature of call target.
And I can’t find the ngfactory.ts file ,so i don’t know how to solve it . so sad …` $ng --version
@angular/cli: 1.0.0 node: 7.2.0 os: darwin x64 @angular/common: 2.4.10 @angular/compiler: 2.4.10 @angular/core: 2.4.10 @angular/forms: 2.4.10 @angular/http: 2.4.10 @angular/platform-browser: 2.4.10 @angular/platform-browser-dynamic: 2.4.10 @angular/router: 3.4.10 @angular/cli: 1.0.0 @angular/compiler-cli: 2.4.10
`
Hi, Thanks @TheZeroNine I had also the same issue. But it only appears on ‘ng build --prod --aot’ and not on ‘ng serve’. Is it possible to see these error before starting a build. (don’t want to start build after every change -.-)
I’m sorry but this issue really is a duplicate of https://github.com/angular/angular-cli/issues/5623. The fix for the outstanding errors really is to fix your templates (e.g. change the variables that are private and need to be accessed in templates to public).
As mentioned in #5623 these really are AOT errors and it was a CLI bug that they weren’t reported before.
We agree that it’s a very bad experience to non-AOT builds to work, but then for AOT builds to not work. The plan for the future is to have AOT builds be fast enough they can be used even during development so this doesn’t happen anymore, but we’re not there yet.
I hope this is of help to someone out there, wondering why their recently updated angular4(…but only moments ago, angular2) project won’t build without throwing this decipherable message _"ERROR in /Users/me/Desktop/kodotest/src/$$gendir/app/app.component.ngfactory.ts (4352,35): Supplied parameters do not match any signature of call target."
Aha…ok…thanks for that! What ever could you mean?..First of all, I don’t own a factory…ahem! Ok, enough jibbering…DO THIS!(I’m on a Mac.Not sure if Terminal prompts are identical on Windows.)
Strangely enough, I still get an error…(error: unknown option `–silent’ ) but IT STILL BUILDS! And outputs my dist folder…
Hope this saves someone an hour.
@ben-coble-sp fixed it just an error on my side
This link wasvery helpful https://github.com/qdouble/angular-webpack2-starter#aot--donts Still have a problem using pipes
Not sure if this was mentioned, but I found “private”: true in package.json. After removing this line and restarting the app, ng build worked for me
#5601 gives better error reporting. We just need to be alittle patient for it to be released. Maybe a 1.0.2 ?
So just wanted to add my 2cents (australian, not sure how much that is US).
We were struggling with these problems and it is I think not reasonable for ng serve to work and then have build issues but I probably just don’t have enough fingers in the pie’s of Angular/cli to know how it all hangs together, anyway.
We are now running everything at latest, 4.1.0 and CLI 1.0.1.
We updated all of our dependant packages of which thankfull we don’t have many but some awesome people had already upgraded their projects to use Angular 4, some olders are still not updated but are working fine.
ng serve and prod build now all work fine, so I think we were stuck in a loop of cli version mismatching with angular version and also some 3rd party packages. I did go through and change custom filters we had created to ensure the right number of parameters were matching.
I know this could be a big step for some people but for us it was worth it and 2 of us sat down with a strong cup of tea and knocked it over in 2 hours.
Just got 1 package that a previous developer got from somewhere which has to be completely replaced.
same problem with cli 1.0.0, but I downgrade to 1.0.0-rc4 and it works without errors.
@webcat12345 Thx , I check my code again , and i find the problem and slove.
I also can’t find the ngfactory files after build errors. If I had them, it would be much easier to debug… (using @angular/cli version 1.0.0, @angular/* version 2.4.10, and typescript version 2.0.2)