Closed webcat12345 closed 7 years ago
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
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 have these after upgrading form angular cli beta into version 1.0. the sad part is my project is too big to handle this :(
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
`
@ginkosen
Check TerminalListComponent
, then you can see this kind of issue.
HTML :
<element (click)="customfn(a, b)"></element>
Typescript :
public customfn(param:any):void {
...
}
As you can see Supplied parameters do not match any signature of call target.
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)
I am having this issue as well. Is there a way to find that ngfactory file? Also, it would be great if the error message could show the name of the call target or something similar to identify the offending method
@webcat12345 Thx , I check my code again , and i find the problem and slove.
Problem is some npm packages are having same issues. They should be upgraded to latest angular and angular/cli version since we are using Angular4 and angular/cli 1.0.0.
why ng serve and ng build (without --prod option) are OK ?!!!!!
make the property hours,test_detail_mode,statistic public.
I am having issues with ng build
and ng 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
ERROR in ./src/$$_gendir/app/app.module.ngfactory.ts
Module not found: Error: Can't resolve 'XYZ' in '/.../demo/src/$$_gendir/app'
@ ./src/$$_gendir/app/app.module.ngfactory.ts 24:0-37
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:3000 ./src/main.ts
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.
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.) 1) In Terminal execute: "npm install -g angular-cli-ghpages" 2) In your app's 'package.json', add the line: "deploy": "ng build -sm -ec -bh /aboutme/ & ngh --silent=false", 3) Finally, in Terminal execute: "npm run deploy"
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.
I love the CLI, guys!
Can you write the generated files in $$_gendir
to disk, so that AoT users can debug?
--edit: this is actually a webpack-related question.
When AoT compilation files, one can read the source files in browser with:
http://localhost:4200/src/app/app.component.ts :arrow_right: HTTP 200
but the generated files are not: http://localhost:4200/src/$$_gendir/app/app.component.ngfactory.ts :arrow_right: HTTP 404
same problem with cli 1.0.0, but I downgrade to 1.0.0-rc4 and it works without errors.
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.
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 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.
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
Me, personally that seems like "possibly" a good way to hide certain behaviour, without reading I don't know what that setting does, I would prefer to have everything up to date and building correctly which just took us a bit of time.
I have total faith in the team because they fixing things very well as they come up on subsequent minor releases and we are very happy with what is coming out.
This link wasvery helpful https://github.com/qdouble/angular-webpack2-starter#aot--donts Still have a problem using pipes
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:
This link wasvery helpful https://github.com/qdouble/angular-webpack2-starter#aot--donts Still have a problem using pipes
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/5733#issuecomment-301756212, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ65fet0aKaf6D6MkAMCRhqqaUv_hNcVks5r6YuQgaJpZM4MtGxa .
@iansamz By pipes do you mean pipes used to transform data or do you mean pipes used to indicate that parameters may be of several types (aka | as an OR operator)? If it's the later, see this comment https://github.com/angular/angular-cli/issues/5623#issuecomment-289577009
@ben-coble-sp fixed it just an error on my side
I'm still error with this issue.
$ ng --version
/ \ | | / | | | | / △ \ | ' \ / ` | | | | |/ ` | '| | | | | | | / | | | | (| | || | | (| | | | |__| | | | // __| ||_, |_,||_,|| __|__|| |/ @angular/cli: 1.1.3 node: 8.1.2 os: win32 x64 @angular/animations: 4.2.4 @angular/common: 4.2.4 @angular/compiler: 4.2.4 @angular/core: 4.2.4 @angular/forms: 4.2.4 @angular/http: 4.2.4 @angular/material: 2.0.0-beta.7 @angular/platform-browser: 4.2.4 @angular/platform-browser-dynamic: 4.2.4 @angular/platform-server: 4.2.4 @angular/router: 4.2.4 @angular/cli: 1.1.3 @angular/compiler-cli: 4.2.4
I'm not sure, Is is another solution instead of change private to public?
I had an error in my templates which only showed up when building with --aot. I Isolated it by removing template to make sure that's where it was and then just searching through the events until I found calls that didn't match the signatures of their methods. Once, I fixed that, it compiled with --aot. Would have been better to have a more helpful error message.
I had the following case: with "ng build" worked fine.
with "ng build -prod" failed with:
ERROR in ..../src/$$_gendir/app/app.module.ngfactory.ts (499,57): Supplied parameters do not match any signature of call target.
In app modules had:
providers: [
{
provide: Http,
useFactory: translateHttpServiceLoader,
deps: [XHRBackend, RequestOptions]
}
]
and
export function translateHttpServiceLoader(backend: XHRBackend, options: RequestOptions, router: Router) {
return new HttpService(backend, options, router);
}
I've found that useFactory
should have only 2 params.
I've removed the last param and now is building fine also with "ng build -prod"
working version:
export function translateHttpServiceLoader(backend: XHRBackend, options: RequestOptions) {
return new HttpService(backend, options);
}
xxx How do we make ng serve
show us the errors that ng build -prod
does? xxx
Just upgraded to latest angular-cli 1.2.7 (but was having the same issues right before with 1.0.0-beta30 as well)
@angular/cli: 1.2.7
node: 7.5.0
os: darwin x64
@angular/animations: 4.0.0
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.2.7
@angular/compiler-cli: 4.0.0
ng build -prod
is giving me ~400's of errors like this, which I do NOT get in ng serve
:
Property 'editing' is private and only accessible within class 'XxxxxxXxxxxComponent'.
Property 'name' does not exist on type 'Object'.
This last error is coming from html template where we do myObject.name
... apparently it wants myObject['name']
, which is annoying :) But ok, I can change to any
to fix this...
I'm fine fixing these, but HOW do I get ng serve
to inform us during development rather than surprise us later when building ng build -prod
for production??? That is going to be a bad thing for us, i'd like to avoid.
Backstory:
We used to use 1.0.0-beta30
for months, just fine, many clean npm install
s, no errors when using ng build -prod
. (1.0.0-beta30
of @angular/cli
and 2.3.1
of @angular/core
and friends).... until today.
For some reason this bug JUST showed up for us in the last two days after one of us did a rm -rf node_modules && npm install && ng build -prod
- the others on the team could still build with -prod
fine, but immediately break when they issue the same npm install command!! ... Which prompted us to upgrade to latest 1.2.7 cli which uses angular 4.0.0. And we use all fixed versions in our package.json, so some sub dep must have changed in npm to cause this because our versions are fixed (wtf indeed).
part of package.json
"dependencies": {
"@angular/animations": "4.0.0",
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@angular/router": "4.0.0",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.14",
"@types/mixpanel": "0.0.28",
"angular2-autosize": "1.0.1",
"angular2-medium-editor": "1.0.6",
"angular2-notifications": "0.4.51",
"angular2-uuid": "1.1.1",
"bootstrap": "4.0.0-alpha.5",
"core-js": "2.4.1",
"intl": "1.2.5",
"jquery": "3.1.1",
"lodash": "4.17.4",
"marked": "0.3.6",
"medium-editor": "5.22.2",
"medium-editor-markdown": "2.6.0",
"moment": "2.18.1",
"ng-click-outside": "2.0.2",
"ng2-select2": "1.0.0-beta.10",
"remove-markdown": "0.1.0",
"rxjs": "5.4.1",
"select2": "4.0.3",
"semaphore": "1.0.5",
"sweetalert2": "6.4.2",
"three": "0.86.0",
"ts-helpers": "1.1.1",
"zone.js": "0.8.14"
},
"devDependencies": {
"@angular/cli": "1.2.7",
"@angular/compiler-cli": "4.0.0",
"@types/jasmine": "2.5.53",
"@types/jasminewd2": "2.0.2",
"@types/lodash": "4.14.71",
"@types/medium-editor": "5.0.1",
"@types/node": "6.0.60",
"@types/selenium-webdriver": "2.53.36",
"@types/three": "0.84.19",
"codelyzer": "3.0.1",
"http-server": "0.10.0",
"jasmine-core": "2.6.2",
"jasmine-spec-reporter": "4.1.0",
"karma": "1.7.0",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.2.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-phantomjs-launcher": "1.0.0",
"karma-remap-istanbul": "0.2.1",
"karma-spec-reporter": "0.0.26",
"karma-verbose-reporter": "0.0.3",
"node-sass": "3.13.0",
"phantomjs-polyfill": "0.0.2",
"phantomjs-prebuilt": "2.1.7",
"protractor": "5.1.2",
"raw-loader": "0.5.1",
"sass-loader": "4.0.2",
"ts-node": "3.0.4",
"tslint": "5.3.2",
"typescript": "2.3.3",
"typings": "2.1.1",
"webdriver-manager": "10.2.5"
}
You can replicate this problem, by creating a brand new simple empty project, with this sequence:
ng new project
(gives us @angular/cli
1.2.7
and @angular/core
and friends 4.0.0
)
cd project
edit src/app/app.component.ts
(change title = 'app';
to private title = 'app';
)
npm start
(works! but should not... very misleading during development)
> project@0.0.0 start /Users/username/src/project
> ng serve
NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200
Hash: 7449fd53eff15e84d8b5
Time: 5212ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 177 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, main.bundle.js.map (main) 5.28 kB {3} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 10.5 kB {4} [initial] [rendered]
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.19 MB [initial] [rendered]
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.
- `ng build -prod` **(doesn't work!)**
Hash: d066ff91b21cc6eafccb
Time: 7596ms
chunk {0} polyfills.550cf10c9aa54b8194c7.bundle.js (polyfills) 177 kB {4} [initial] [rendered]
chunk {1} main.2149231fc44e7510bd2f.bundle.js (main) 13.5 kB {3} [initial] [rendered]
chunk {2} styles.d41d8cd98f00b204e980.bundle.css (styles) 69 bytes {4} [initial] [rendered]
chunk {3} vendor.330bdb50b9e3457f8646.bundle.js (vendor) 849 kB [initial] [rendered]
chunk {4} inline.95b082410a205220057a.bundle.js (inline) 0 bytes [entry] [rendered]
ERROR in /Users/username/src/project/src/$$_gendir/app/app.component.ngfactory.ts (57,31): Property 'title' is private and only accessible within class 'AppComponent'.
The apparent solution then is to make the variable `public`... easy on this toy project, hard on a old/large project with ~400+ errors.
From other threads, you can work around the problem. Meaning, you CAN use -prod
or --aot
without changing any private
to public
, or fixing other errors...
Tested with my Angular 4.0.0
described above, which was installed by cli@1.2.7
Couple different ways to disable those errors in AoT mode:
Hack, which is not optimal and does not carry over on reinstalls.
npm install --save-dev @ngtools/webpack@1.2.14
rm -rf node_modules/\@angular/cli/node_modules/\@ngtools/webpack/
npm install --save-dev enhanced-resolve@3.3.0
and pin those versions....
...Tested with cli@1.2.7.
...enhanced-resolve
fixes the error Can't resolve './$$_gendir/app/app.module.ngfactory'
OR
A better workaround is to use @angular/cli@1.0.0-rc.4
instead, as it carries over reinstalls and there isn't a big difference between the two versions.
"devDependencies": {
"@angular/cli": "1.0.0-rc.4",
"@ngtools/webpack": "1.2.14",
...
}
without the enhanced-resolve@3.3.0
from the first one or it wont work...
I tested both with a large project, and I no longer get those ~400+ errors about private
and others when building with ng build -prod
and ng serve --aot
Thanks to @filipesilva and @adwd References:
So, Out of the box @angular/cli@1.2.7
has an inconsistency between ng serve
(allowing errors) and ng build -prod
(where errors stop the show). See reproduction steps I posted above.
What is the long term solution going to be? Anyone know? Do we at least agree this should have a resolution?
I see 3 possibilities to fix this:
ng serve
to emit (and potentially stop on) the same errors as ng build -prod
so you're not surprised when making a prod build.ng build -prod
so that these private
errors are ignored and dont 'stop the show' (or simply aren't errors). Like it works in the workaround I posted above.private
vars and make javascript style object.key
references instead of object['key']
- so it is then correct to reference private vars from within a template. (maybe more of a philosophical point to decide)Question: today, is there a flag I can use on ng serve
which makes it emit those same errors as ng build -prod
? Without --aot
which seems too slow for our team (we dont want to give up the fast iteration).
Okay so how again are we suppose to figure out where the problem is if we have a:
ERROR in C:/.../src/$$_gendir/app/app.module.ngfactory.ts (159,52): Supplied parameters do not match any signature of call target.
??? Can we somehow keep the $$_gendir around? Is there some log file that it spits out? I have no clue what it is complaining about and I've spent about 5 hours looking through all the code and there is a lot of it.
i have error like this ng -v
/ \ | | / | | | | / △ \ | ' \ / ` | | | | |/ ` | '| | | | | | | / | | | | (| | || | | (| | | | |__| | | | // __| ||_, |_,||_,|| __|__|| |/ @angular/cli: 1.4.3 node: 7.10.1 os: linux x64 @angular/animations: error @angular/common: error @angular/compiler: 4.4.4 @angular/core: error @angular/forms: error @angular/http: error @angular/platform-browser: error @angular/platform-browser-dynamic: error @angular/router: error @angular/cli: error @angular/compiler-cli: 4.4.4 @angular/language-service: error typescript: 2.0.10
how to solve this error package.json:
"dependencies": { "@angular/animations": "^4.0.0", "@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/core": "^4.0.0", "@angular/forms": "^4.0.0", "@angular/http": "^4.0.0", "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/router": "^4.0.0", "bootstrap": "^3.3.7", "core-js": "^2.4.1", "rxjs": "^5.1.0", "zone.js": "^0.8.4" }, "devDependencies": { "@angular/cli": "^1.2.0", "@angular/compiler-cli": "^4.0.0", "@angular/language-service": "^4.0.0", "@types/jasmine": "2.5.45", "@types/node": "~6.0.60", "codelyzer": "~3.0.1", "jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0", "karma": "~1.7.0", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~3.0.4", "tslint": "~5.3.2", "typescript": "~2.0.0" }
For anyone stuck on an old version of Angular and winds up here with this issue: we worked around it by adding a fake build step to our unit tests. In our workflow, this will throw the error before a push, or at the worst throw the error on the test step before it gets all the way to the production build.
Something like this (package.json):
"scripts": {
...
"fake-build": "ng build --prod --aot --target=production",
...
"test": "npm run fake-build && ng test --browsers ChromeHeadless --single-run",
...
},
This does make running the unit tests much slower, but at least stops the embarrassment of a surprise breaking of the production build.
The issue in my case was that My component was running, Stopped it and ran " ng build --prod --aot" and it worked.
help I have a problem problem mark me this error when I put the command ng build --prod
Date: 2019-06-26T19:47:29.429Z Hash: 47649eb13e262d7eaef3 Time: 45551ms chunk {0} runtime-es5.741402d1d47331ce975c.js (runtime) 1.41 kB [entry] [rendered] chunk {1} main-es5.7c04bb8524a34ea08589.js (main) 828 kB [initial] [rendered] chunk {2} polyfills-es5.b8d6dd293b73bbb8581d.js (polyfills) 132 kB [initial] [rendered] chunk {scripts} scripts.000eefc49a6f20ab379c.js (scripts) 607 kB [entry] [rendered]
ERROR in scripts.000eefc49a6f20ab379c.js from Terser Unexpected character '@' [scripts.000eefc49a6f20ab379c.js:17652,1]
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Bug Report
Versions.
Output from:
ng --version
.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.
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.