Error when build for production


i got this problem when i enter following code to build my app to production

ionic build android --prod

i got this error

[22:09:48] ionic-app-script task: “build”
[22:09:48] TypeError: Cannot read property ‘codeGen’ of undefined
TypeError: Cannot read property ‘codeGen’ of undefined
at Object.doCodegen (/Users/ali/Desktop/ionic 2 fin/test/node_modules/@ionic/app-scripts/dist/aot/codegen.js:6:50)
at /Users/ali/Desktop/ionic 2 fin/test/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:42:30

my system info is

Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.4
ios-deploy version: Not installed
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.10.2
Xcode version: Xcode 8.2.1 Build version 8C1002


Please post package.json


“name”: “ionic-hello-world”,
“author”: “Ionic Framework”,
“homepage”: “”,
“private”: true,
“scripts”: {
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
“dependencies”: {
"@angular/common": “2.2.1”,
"@angular/compiler": “2.2.1”,
"@angular/compiler-cli": “2.2.1”,
"@angular/core": “2.2.1”,
"@angular/forms": “2.2.1”,
"@angular/http": “2.2.1”,
"@angular/platform-browser": “2.2.1”,
"@angular/platform-browser-dynamic": “2.2.1”,
"@angular/platform-server": “2.2.1”,
"@ionic/storage": “1.1.6”,
“ionic-angular”: “2.0.0-rc.4”,
“ionic-native”: “2.2.11”,
“ionicons”: “3.0.0”,
“ngrx-store-localstorage”: “^0.1.6”,
“rxjs”: “5.0.0-beta.12”,
“zone.js”: “0.6.26”
“devDependencies”: {
"@ionic/app-scripts": “^1.3.4”,
“typescript”: “2.0.9”
“cordovaPlugins”: [
“cordovaPlatforms”: [],
“description”: “PHPCRUD: An Ionic project”


You probably need to update your Ionic so you are running Angular 4. (See here.) You could try to install Angular 4 and keep your current framework, and you might be ok, but my suggestion is you update your Ionic to framework 3 (not CLI 3), which will get you to Angular 4 automatically.


thanks for your help can you provide a cli code to update my app to ionic 3


any one can help the problem still exist


The ionic version you are using is too old. Current(2017-05-13) version is ionic 3, the one you are using is ionic 2 release candidate version. If your app is not quite large, I recommend updating your global ionic and creating another app.

Update your ionic-cli by running:

npm update -g ionic

Then find another directory and create a new app:

ionic start newApp blank

Use git to do version control.
Then little by little, move your old code into the new app. We just migrated our app this way to the latest ionic 3. I believe other migration method could not make it “latest”. ;p


after i updated to ionic 3 and put my src folder in new project
i got blank screen when serve this is my new json

“name”: “ward44”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “”,
“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
“dependencies”: {
"@angular/common": “4.1.0”,
"@angular/compiler": “4.1.0”,
"@angular/compiler-cli": “4.1.0”,
"@angular/core": “4.1.0”,
"@angular/forms": “4.1.0”,
"@angular/http": “4.1.0”,
"@angular/platform-browser": “4.1.0”,
"@angular/platform-browser-dynamic": “4.1.0”,
"@ionic-native/core": “3.7.0”,
"@ionic-native/splash-screen": “3.7.0”,
"@ionic-native/status-bar": “3.7.0”,
"@ionic/storage": “2.0.1”,
“ionic-angular”: “3.2.1”,
“ionicons”: “3.0.0”,
“rxjs”: “5.1.1”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.10”
“devDependencies”: {
"@ionic/app-scripts": “1.3.7”,
"@ionic/cli-plugin-cordova": “1.0.0”,
"@ionic/cli-plugin-ionic-angular": “1.0.0”,
“typescript”: “2.2.1”
“description”: “An Ionic project”


i solved the problem
build for production because of my old ionic version
and the blank screen because of [options]=“mySlideOptions” in slider not supported in ionic 3
thanks every body