Ionic cordova build ios --prod fails every time

#1

Hi,
Since 2 weeks I’m getting this error. I’ve got through every possible answer and have tried every solution but still not able to find solution to this.

ionic cordova build ios --prod

My app is becoming slow cause of no –prod

ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.11
    Cordova Platforms  : android 7.0.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    ios-deploy : 2.0.0 
    Node       : v10.6.0
    npm        : 6.1.0 
    OS         : macOS High Sierra
    Xcode      : Xcode 9.4.1 Build version 9F2000 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

package.json

{
  "name": "AppName",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "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/animations": "^4.4.6",
    "@angular/common": "^4.4.6",
    "@angular/compiler": "^4.4.6",
    "@angular/compiler-cli": "^4.4.6",
    "@angular/core": "^4.4.7",
    "@angular/forms": "^4.4.6",
    "@angular/http": "^4.4.6",
    "@angular/platform-browser": "^4.4.6",
    "@angular/platform-browser-dynamic": "^4.4.6",
    "@angular/tsc-wrapped": "^4.4.6",
    "@ionic-native/android-permissions": "4.11.0",
    "@ionic-native/app-version": "4.11.0",
    "@ionic-native/badge": "4.11.0",
    "@ionic-native/base64-to-gallery": "4.11.0",
    "@ionic-native/call-number": "4.11.0",
    "@ionic-native/camera": "4.11.0",
    "@ionic-native/core": "4.11.0",
    "@ionic-native/device": "4.11.0",
    "@ionic-native/diagnostic": "4.11.0",
    "@ionic-native/email-composer": "4.11.0",
    "@ionic-native/file": "4.11.0",
    "@ionic-native/file-chooser": "4.11.0",
    "@ionic-native/file-opener": "4.11.0",
    "@ionic-native/file-path": "4.11.0",
    "@ionic-native/file-transfer": "4.11.0",
    "@ionic-native/geolocation": "4.11.0",
    "@ionic-native/globalization": "4.11.0",
    "@ionic-native/in-app-browser": "4.11.0",
    "@ionic-native/keyboard": "4.11.0",
    "@ionic-native/media": "4.11.0",
    "@ionic-native/media-capture": "4.11.0",
    "@ionic-native/network": "4.11.0",
    "@ionic-native/onesignal": "4.11.0",
    "@ionic-native/photo-library": "4.11.0",
    "@ionic-native/photo-viewer": "4.11.0",
    "@ionic-native/shake": "4.11.0",
    "@ionic-native/social-sharing": "4.11.0",
    "@ionic-native/splash-screen": "4.11.0",
    "@ionic-native/sqlite": "4.11.0",
    "@ionic-native/status-bar": "4.11.0",
    "@ionic-native/streaming-media": "4.11.0",
    "@ionic-native/unique-device-id": "4.11.0",
    "@ionic-native/vibration": "4.11.0",
    "@ionic-native/video-capture-plus": "4.11.0",
    "@ionic-native/video-editor": "4.11.0",
    "@ionic-native/video-player": "4.11.0",
    "@ionic/cli-utils": "^1.19.1",
    "@ionic/storage": "^2.1.3",
    "@ngx-translate/core": "^9.1.1",
    "@ngx-translate/http-loader": "^2.0.1",
    "@types/underscore": "^1.8.3",
    "angular2-moment": "^1.8.0",
    "angular2-uuid": "^1.1.1",
    "buffer-crc32": "^0.2.13",
    "callsite": "^1.0.0",
    "com-sarriaroman-photoviewer": "^1.1.16",
    "cordova-android": "^7.1.0",
    "cordova-base64-to-gallery": "^4.1.3",
    "cordova-browser": "~4.1.0",
    "cordova-ios": "4.5.4",
    "cordova-plugin-add-swift-support": "^1.7.1",
    "cordova-plugin-android-permissions": "^1.0.0",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-badge": "^0.8.7",
    "cordova-plugin-camera": "^4.0.2",
    "cordova-plugin-cocoapod-support": "^1.3.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.1",
    "cordova-plugin-file": "^5.0.0",
    "cordova-plugin-file-opener2": "^2.0.19",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-filechooser": "^1.0.1",
    "cordova-plugin-globalization": "^1.0.9",
    "cordova-plugin-inappbrowser": "^2.0.2",
    "cordova-plugin-ionic-webview": "^1.1.16",
    "cordova-plugin-media": "^3.0.1",
    "cordova-plugin-media-capture": "^3.0.1",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-photo-library": "^2.1.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.1",
    "cordova-plugin-streaming-media": "^1.0.2",
    "cordova-plugin-uniquedeviceid": "^1.3.2",
    "cordova-plugin-vibration": "^3.0.1",
    "cordova-plugin-video-capture-plus": "^1.0.0",
    "cordova-plugin-video-editor": "^1.1.3",
    "cordova-plugin-video-player": "git+https://github.com/moust/cordova-plugin-videoplayer.git",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlite-storage": "^2.3.3",
    "cordova.plugins.diagnostic": "^3.9.2",
    "firebase": "^5.2.0",
    "font-awesome": "^4.7.0",
    "i": "^0.3.6",
    "ionic-angular": "^3.9.2",
    "ionic-img-viewer": "^2.9.0",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic2-auto-complete-ng5": "^1.0.3-release",
    "ionicons": "^3.0.0",
    "mime-types": "^2.1.18",
    "moment": "^2.20.1",
    "ng-elastic": "^1.0.0-beta.5",
    "ngx-order-pipe": "^2.0.1",
    "node-sass": "^4.5.3",
    "onesignal-cordova-plugin": "^2.3.3",
    "promise-polyfill": "6.1.0",
    "rxjs": "^5.5.7",
    "socket.io-client": "^2.0.3",
    "sw-toolbox": "3.6.0",
    "typings": "^2.1.1",
    "underscore": "^1.8.3",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.11",
    "typescript": "^2.9.2"
  },
  "description": "An Ionic project",
  "config": {
    "ionic_copy": "./config/copy.config.js",
    "ionic_sass": "./config/sass.config.js"
  },
  "cordova": {
    "plugins": {
      "cordova-plugin-compat": {},
      "cordova-plugin-app-version": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-network-information": {},
      "cordova-base64-to-gallery": {},
      "cordova-plugin-add-swift-support": {},
      "cordova-plugin-badge": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-media-capture": {},
      "cordova.plugins.diagnostic": {},
      "cordova-plugin-vibration": {},
      "cordova-plugin-video-editor": {},
      "cordova-plugin-uniquedeviceid": {},
      "cordova-plugin-globalization": {},
      "cordova-plugin-photo-library": {
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "To save files in Library"
      },
      "onesignal-cordova-plugin": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-file-opener2": {},
      "com-sarriaroman-photoviewer": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-file": {},
      "cordova-plugin-media": {
        "MICROPHONE_USAGE_DESCRIPTION": " "
      },
      "com.hutchind.cordova.plugins.streamingmedia": {},
      "nl.x-services.plugins.videocaptureplus": {},
      "cordova-plugin-android-permissions": {},
      "cordova-plugin-cocoapod-support": {},
      "com.moust.cordova.videoplayer": {},
      "cordova-plugin-filechooser": {},
      "ionic-plugin-keyboard": {}
    },
    "platforms": [
      "browser",
      "android",
      "ios"
    ]
  }
}

error

Running app-scripts build: --prod --platform ios --target cordova
[21:32:30]  build prod started ... 
[21:32:30]  clean started ... 
[21:32:30]  clean finished in 3 ms 
[21:32:30]  copy started ... 
[21:32:30]  deeplinks started ... 
[21:32:31]  deeplinks finished in 823 ms 
[21:32:31]  ngc started ... 
Error: Cannot determine the module for class OverlayPortal in /app-path/node_modules/ionic-angular/components/app/overlay-portal.d.ts! Add OverlayPortal to the NgModule to fix it.
Cannot determine the module for class IonicApp in /app-path/node_modules/ionic-angular/components/app/app-root.d.ts! Add IonicApp to the NgModule to fix it.
Cannot determine the module for class ClickBlock in /app-path/node_modules/ionic-angular/components/app/click-block.d.ts! Add ClickBlock to the NgModule to fix it.
    at syntaxError (/app-path/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
    at analyzeAndValidateNgModules (/app-path/node_modules/@angular/compiler/bundles/compiler.umd.js:24166:15)
    at AotCompiler.analyzeModulesAsync (/app-path/node_modules/@angular/compiler/bundles/compiler.umd.js:23797:46)
    at CodeGenerator.codegen (/app-path/node_modules/@angular/compiler-cli/src/codegen.js:32:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (/app-path/node_modules/@angular/compiler-cli/src/ngtools_api.js:73:30)
    at /app-path/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:182:73
    at step (/app-path/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23)
    at Object.next (/app-path/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53)
    at fulfilled (/app-path/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58)
[21:32:38]  copy finished in 8.36 s