Compilation fails during build process in genymotion whereas application loads fine on ionic serve.
[15:33:27] lint finished in 3.29 s
[15:33:45] ngc error: Error: Error at D:/tmp/ionic2/rc0MyApp/.tmp/app/app.modul
e.ngfactory.ts:419:107: Property ‘string’ does not exist on type ‘typeof “D:/tmp
/ionic2/rc0MyApp/.tmp/providers/user”’.
Error at D:/tmp/ionic2/rc0MyApp/.tmp/app/app.module.ngfactory.ts:419:140: Proper
ty ‘string’ does not exist on type ‘typeof “D:/tmp/ionic2/rc0MyApp/.tmp/provider
s/user”’.
Error at D:/tmp/ionic2/rc0MyApp/.tmp/app/app.module.ngfactory.ts:419:173: Proper
ty ‘string’ does not exist on type ‘typeof “D:/tmp/ionic2/rc0MyApp/.tmp/provider
s/user”’.
at check (D:\tmp\ionic2\rc0MyApp\node_modules@angular\tsc-wrapped\src\tsc.j
s:31:15)
at Tsc.typeCheck (D:\tmp\ionic2\rc0MyApp\node_modules@angular\tsc-wrapped\s
rc\tsc.js:86:9)
at D:\tmp\ionic2\rc0MyApp\node_modules@angular\tsc-wrapped\src\main.js:33:2
3
at process._tickCallback (internal/process/next_tick.js:103:7)
at Module.runMain (module.js:592:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
i cleared them… all these are errors based on new angular2 and ionic rc0… Somehow these escapes ionic serve
but until all these are solved I was not able to run the app in device.
The problem is that the error from ionic are a little bit confusing, They are pointing at temporary files. But the issues are actually correct.
It looks like the ngc is looking at the html file when compiling, and since there is no checking (in my visual code) I couldn’t see some of the bad practices I had.
Mostly I had error when I was using directly a var in the html but didn’t declared it before in the ts file.
It happened also when I was using private var from my Component in the html. There should be public to do that
The ionic error messages could be a little bit clearer, that would help, but now it works like a charm
[21:56:25] ngc: Error: Error at D:/Users/User/Desktop/project/.tmp/app/app.module.ngfactory.ts:587:140: Property 'string' does not exist on type 'typeof "D:/Users/User/Desktop/project/.tmp/providers/firebase.service"'.
at check (D:\Users\User\Desktop\project\node_modules\@angular\tsc-wrapped\src\tsc.js:31:15)
at Tsc.typeCheck (D:\Users\User\Desktop\project\node_modules\@angular\tsc-wrapped\src\tsc.js:86:9)
at D:\Users\User\User\project\node_modules\@angular\tsc-wrapped\src\main.js:33:23
at process._tickCallback (internal/process/next_tick.js:103:7)
at Module.runMain (module.js:592:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
Unfortunately, I cannot remove string from my constructor as I need it to extend the AngularFire class. Anyone know what the proper way to handle this error is?
From my experience I would says that the error come from a template html. Check if you don’t misuse your service there, where the typescript spell check can’t help you on an editor.
I my case this error comes from a provider file, which hence doesn’t have HTML template at all. The problematic parameter is defined as private and is never used outside the component: