Ionic App Build Failed

Hi ,

I got below error while building app for ionic cordova build --prod --release.

[10:55:39] typescript error
Cannot determine the module for class OverlayPortal in
/ProjectPath/node_modules/ionic-angular/umd/components/app/overlay-portal.d.ts!
Add OverlayPortal to the NgModule to fix it. Cannot determine the module for class IonicApp in
/ProjectPath/node_modules/ionic-angular/umd/components/app/app-root.d.ts! Add
IonicApp to the NgModule to fix it. Cannot determine the module for class ClickBlock in
/ProjectPath/node_modules/ionic-angular/umd/components/app/click-block.d.ts!
Add ClickBlock to the NgModule to fix it.

Error: The Angular AoT build failed. See the issues above
at /ProjectPath/\node_modules@ionic\app-scripts\dist\aot\aot-compiler.js:237:55
at step ( /ProjectPath\node_modules@ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
at Object.next ( /ProjectPath\node_modules@ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
at fulfilled ( /ProjectPath\node_modules@ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
at

Here’s my ionic info :
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)

local packages:

@ionic/app-scripts : 3.1.10
Cordova Platforms  : android 6.3.0 browser 5.0.3 ios 4.5.5
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v8.11.3
npm  : 5.6.0
OS   : Windows 8.1

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro  

Please help me.

What’s your node version? because I think you are using ionic 3 and for this, you must use node 8.11.3 or previous version of node.

Sir,

I’m using node v8.11.3
If i build only for release and debug apk ,it is working fine but while i’m building for prod–release showing the same error.

Sorry for late reply, I also face this issue
change you build command --prod to --aot, something like:

ionic cordova build android --aot 

for release build:

ionic cordova build android --aot 

It’s ok.
I changed command --prod to --aot , but it throws the same error.
Kindly do needful.

Thankiew.

Create a blank new ionic 3 project and copy the project src folder into that one and then try building your application. try this first and if not help then try downgrading android studio version and it’s packages.

Is there any other way to resolve ?

The error message is saying that you have components that are not included in any NgModule. The first thing I would do is determine if that is an accurate assessment of the situation or not.