ionic-cli: TypeError: tsDiagnostic.file.getText is not a function
Hi there, im updatet my ionic env and now having theese errors when trying build ios --prod
TypeError: tsDiagnostic.file.getText is not a function
at loadDiagnostic (/Users/user/WebstormProjects/MDMProfileMobile/node_modules/@ionic/app-scripts/dist/logger/logger-typescript.js:32:44)
at /Users/user/WebstormProjects/MDMProfileMobile/node_modules/@ionic/app-scripts/dist/logger/logger-typescript.js:13:16
at Array.map (<anonymous>)
at Object.runTypeScriptDiagnostics (/Users/user/WebstormProjects/MDMProfileMobile/node_modules/@ionic/app-scripts/dist/logger/logger-typescript.js:12:26)
at /Users/user/WebstormProjects/MDMProfileMobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:231:59
at step (/Users/user/WebstormProjects/MDMProfileMobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23)
at Object.next (/Users/user/WebstormProjects/MDMProfileMobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53)
at fulfilled (/Users/user/WebstormProjects/MDMProfileMobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58)
at <anonymous>
ionic info
cli packages: (/Users/user/WebstormProjects/MDMProfileMobile/node_modules)
@ionic/cli-utils : 1.18.0
ionic (Ionic CLI) : 3.18.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.1.2
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.0.2
ios-deploy : 1.9.2
Node : v8.9.1
npm : 5.5.1
OS : macOS Sierra
Xcode : Xcode 9.1 Build version 9B55
Environment Variables:
ANDROID_HOME : /Users/user/Library/Android/sdk
Misc:
backend : pro
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (3 by maintainers)
@soniyj in
node_modules/@ionic/app-scripts/dist/logger/logger-typescript.js:29
changeif (tsDiagnostic.file) {
toif (tsDiagnostic.file && tsDiagnostic.file.getText) {
u can run ./node_modules/.bin/ngc check what cause the error
@ionic/app-scripts
3.1.9 is out with this a fix for this! Sorry for the delay!@zixia @romain10009 This turned out to be a mistake I made in an html file where I did
*ngIf="phones & phones.length"
(I forgot to put&&
)I’m not sure how this causes the issue but to debug your own issue, you can go to the
node_modules/@ionic/app-scripts/dist/logger/logger-typescript.js
And add this followingif
condition and change the other if condition just above line 29and change the if condition on line 29 to include the getText check
Then run the build, and see which file has the typescript error
@staskuban can you please reopen this PR? Maybe so someone will take a look. For my experience the problem occurs when you compile with --aot (therefore also with --prod) a project managed in lazy loading. I made today a project in lazy loading and the problem, which until this morning was not there, suddenly appeared.
+1 I have this error on a lazy loaded project!
I’ve been compiling with --prod with no issues for several weeks. Now it produces this error out of nothing! Why is the PR closed?
if found which cause the error tsDiagnostic.file.getText is not a function i create a custom component in my project in my component html when i use ngIf or ngFor like this example.html
it works ok like this
why
See this PR: https://github.com/ionic-team/ionic-app-scripts/pull/1365
This will be fixed in app-scripts 3.1.9
So do I. +1
I reslove this issue. Problem with https://github.com/kadoshms/ionic2-autocomplete which crashes while compile with no errors. I updated check in logger-typescript fo
if (tsDiagnostic.file && tsDiagnostic.file.getText) ...