0

When I try ionic cordova build android --prod --release command in Ionic 3, it shows an error

[12:24:50] ionic-app-script task: “build” [12:24:50] Error: The Angular AoT build failed. See the issues above Error: The Angular AoT build failed. See the issues above at /Users/angelamal/Documents/osome/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:237:55 at step (/Users/angelamal/Documents/osome/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23) at Object.next (/Users/angelamal/Documents/osome/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53) at fulfilled (/Users/angelamal/Documents/osome/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58) [ERROR] An error occurred while running subprocess ionic-app-scripts. ionic-app-scripts build --prod --target cordova --platform android exited with exit code 1.

While I try to build an android app in Ionic 3.

I used this command ionic cordova build android --prod --release

But it is showing an error. How to solve this?

Thanks in Advance

Sudarshana Dayananda
  • 5,165
  • 2
  • 23
  • 45
  • 1
    Could you share your ionic info output ? – Delwyn Pinto Feb 05 '19 at 07:10
  • Please add more info of your error so we can help you on that. – CodeChanger Feb 05 '19 at 07:13
  • 1
    Don't forget to use the `--verbose` option when building. It will give you more details – rchau Feb 05 '19 at 09:07
  • If the message says... Error: The Angular AoT build failed. See the issues above Error:.... Why haven't you included earlier messages. That would give you hint surely.. – JGFMK Feb 05 '19 at 10:21
  • 1
    Perhaps this will give a clue? https://stackoverflow.com/questions/51124742/ionic-error-when-generating-production-build "You need to import IonicModule in your module.ts" – JGFMK Feb 05 '19 at 10:22
  • Run `ngc` in your project root to highlight errors that would make it through JIT but not AOT compilation and fix those first. Warning: will produce lots of metadata. – Alex Steinberg Feb 05 '19 at 13:23
  • @AlexSteinberg how can I run ngc on the project root? ionic cli 6.13.1 ionic-angular 3.9.2 app-scripts 3.24, cordova cli 11.0.0, nodejs 10.16.0, npm 6.9.0 Thank you. I am getting (Invalid provider for the NgModule 'AppModule) followed by (Error: The Angular AoT build failed) building PWA with (ionic cordova build browser --prod --release) it's happy if I drop --prod :( in the meantime I am running (npm run lint) over and over to cleanup stuff. – Meryan May 14 '22 at 16:29
  • @AlexSteinberg you may have insights on similar where I am able to provide a bit more details. Thank you. https://stackoverflow.com/questions/72245178/how-can-i-upgrade-node-js-to-v14-x-with-ionic-3 – Meryan May 15 '22 at 02:34

0 Answers0