Error trying to build for Android or ios

Hey guys,

I am experiencing an issue when I try to build using the --prod flag. Here is what I get:
[11:10:54] ionic-app-scripts 1.1.4
[11:10:54] build prod started …
[11:10:54] clean started …
[11:10:54] clean finished in 18 ms
[11:10:54] copy started …
[11:10:54] ngc started …
[11:11:07] build prod failed: Cannot determine the module for class SummaryPage in
/Users/Britt/Desktop/Apps/cnh2/src/pages/summary/summary.ts!
[11:11:07] ionic-app-script task: “build”
[11:11:07] Error: Cannot determine the module for class SummaryPage in
/Users/Britt/Desktop/Apps/cnh2/src/pages/summary/summary.ts!
Error: Cannot determine the module for class SummaryPage in /Users/Britt/Desktop/Apps/cnh2/src/pages/summary/summary.ts!
at analyzeAndValidateNgModules (/Users/Britt/Desktop/Apps/cnh2/node_modules/@angular/compiler/bundles/compiler.umd.js:12707:17)
at OfflineCompiler.compileModules (/Users/Britt/Desktop/Apps/cnh2/node_modules/@angular/compiler/bundles/compiler.umd.js:12775:20)
at CodeGenerator.codegen (/Users/Britt/Desktop/Apps/cnh2/node_modules/@angular/compiler-cli/src/codegen.js:58:30)
at Object.runCodegen (/Users/Britt/Desktop/Apps/cnh2/node_modules/@ionic/app-scripts/dist/aot/codegen/codegen-ng22.js:15:26)
at Object.doCodegen (/Users/Britt/Desktop/Apps/cnh2/node_modules/@ionic/app-scripts/dist/aot/codegen.js:6:31)
at /Users/Britt/Desktop/Apps/cnh2/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:41:30

npm ERR! Darwin 15.6.0
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “ionic:build” “–” “–prod” "–release"
npm ERR! node v6.10.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ ionic:build: ionic-app-scripts build "--prod" "--release"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@ ionic:build script ‘ionic-app-scripts build “–prod” “–release”’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts build “–prod” "–release"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/Britt/Desktop/Apps/cnh2/npm-debug.log

I have tried to uninstall npm, cordova, and Ionic, and install… this has not changed the error message.
I am using Ionic 2.2.1, cordova 6.5.0, node js 6.10.1.

I am able to run the app through ionic serve. I can even build it using --release but the app has a delay of 10-15 seconds before starting. I have seen on other posts that using the --prod flag will reduce this delay. I am not able to build using this feature.

Any ideas of what to do??

Thank you,
David

I was able to build with iOS. The issue was my version of Typescript.

Can tell us more? What did you update your typescript version to? locally or globally?
I am having the same issue with
ionic run android --prod

First time I try --prod in hope to see the startup/boot time to improve.

Thank you.

What version of typescript are you running? Did you update globally or locally?

Never mind, not my typescript

 npm list typescript
ionic-hello-world@ S:\_W\ARP\UPS.TS\SRC\UPS.TS.2.0
+-- ionic-gulp-browserify-typescript@2.0.0
| `-- tsify@0.14.8
|   `-- typescript@1.8.10
`-- typescript@2.0.10

The FIX, I found several issues

  1. Files I was not using and ionic serve builds did not complain about.
  2. I had this empty @Component in a service remnants from BETA days :slight_smile: again ionic serve builds did not complain about
// 20160715
@Component({
   //   templateUrl: 'build/pages/AMS/AMSView.html'
   //   , providers: [AMSPage]
   // directives: [AMSPlayerComp]
})

Hope someone finds this useful
Thank you.

I had this error: Cannot determine the module for class IntroductionPage.

I searched for the text “IntroductionPage” and found an extra copy of my introduction files outside the ionic /src/pages/ folder.

Simply removing these erroneous files resolved the issue and prod compile was successful.