IONIC build ios --prod does not work for ionic 2

On running “ionic build ios --prod”

I get

[18:06:32]  build prod failed: Error encountered resolving symbol values statically. Expression form not supported 
            (position 102:31 in the original .ts file), resolving symbol Storage in 
            /Users/saulabiuakinlolu/Documents/hanovermobileui/node_modules/@ionic/storage/es2015/storage.d.ts 
[18:06:32]  ionic-app-script task: "build" 
[18:06:32]  Error: Error encountered resolving symbol values statically. Expression form not supported (position 102:31 
            in the original .ts file), resolving symbol Storage in 

Here is my package.json contents

    {
  "name": "app",
  "author": "",
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "lint": "ionic-app-scripts lint"
  },
  "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-native/core": "^3.4.4",
    "@ionic-native/file": "^3.4.4",
    "@ionic-native/file-opener": "^3.4.4",
    "@ionic/storage": "1.1.7",
    "@types/filesaver": "0.0.30",
    "crypto-js": "^3.1.9-1",
    "file-saver": "^1.3.3",
    "ionic-angular": "2.0.0",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",
    "ng2-pdf-viewer": "^1.0.2",
    "rxjs": "5.0.0-beta.12",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.0.0",
    "typescript": "2.0.9"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-inappbrowser",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard",
    "cordova-plugin-touch-id",
    "cordova-plugin-device",
    "cordova-plugin-file",
    "cordova-plugin-file-opener2",
    "cordova-plugin-console",
     "cordova-plugin-whitelist"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "config": {
    "ionic_source_map": "source-map"
  },
  "description": "hanoverApp: Hanover Insurance App"
}

Any ideas anyone? really need this to run as the app is running very slowly

You have this installed additionally to

This sounds not like a very good idea.

Also your Ionic Framework and Ionic Storage versions are quite old. Did you think about updating to a current version?

1 Like

I got it to work ended up updating to as follows

{
  "name": "",
  "author": "",
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "lint": "ionic-app-scripts lint"
  },
  "dependencies": {
    "@angular/common": "2.4.8",
    "@angular/compiler": "2.4.8",
    "@angular/compiler-cli": "2.4.8",
    "@angular/core": "2.4.8",
    "@angular/forms": "2.4.8",
    "@angular/http": "2.4.8",
    "@angular/platform-browser": "2.4.8",
    "@angular/platform-browser-dynamic": "2.4.8",
    "@angular/platform-server": "2.4.8",
    "@ionic-native/core": "^3.3.0",
    "@ionic-native/file": "^3.3.0",
    "@ionic-native/file-opener": "^3.3.0",
    "@ionic/storage": "2.0.0",
    "@types/filesaver": "0.0.30",
    "crypto-js": "^3.1.9-1",
    "file-saver": "^1.3.3",
    "ionic-angular": "2.2.0",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",
    "ng2-pdf-viewer": "^1.0.2",
    "rxjs": "5.0.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.7.2"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.1.4",
    "typescript": "2.0.9"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-inappbrowser",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard",
    "cordova-plugin-touch-id",
    "cordova-plugin-device",
    "cordova-plugin-file",
    "cordova-plugin-file-opener2",
    "cordova-plugin-console",
    "cordova-plugin-whitelist"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "config": {
    "ionic_source_map": "source-map"
  },
  "description": ""
}