Error: cannot find module “.” when deploying to ios - Ionic 3

Error Description: I built the project on VsCode using “ionic cordova build ios --prod”, opened it in XCode (project.xcworkspace) and deployed it to an iPhone. However, when I open the app it gets stuck on a blank page. I debugged it using safari’s development tool and I got the following error on console: "Error: cannot find module “.” ".

What I’ve tried: I researched the error and tried a couple solution, but no luck.

  • Changed typescript version to “~2.6.2”, “2.6.2”, “2.8.3”
  • Removed “^” from typescript version;
  • Changed app-script version to “3.1.9”, “3.2.1”, “3.2.2”, “3.2.3”
  • Went through my imports to see if any of them had “/udm”, but none of them do;
  • Also tried different XCode versions: 8, 9, 10 and 12;
  • Tried adding different versions of ios platform: 4.5.0, 4.5.5, 5.0.1, 5.1.0 and the latest;

Here are some links I visited, had no luck with their solutions though:

  1. Build in "prod" mode: Cannot find module "."
  2. Ionic 3: Build in “prod” mode: Cannot find module “.”
  3. Runtime Error - Cannot Find Module "."
  4. How can I resolve Ionic Uncaught Error: Cannot find module “.” when adding new page?

Info:

ionic/cli-utils : 1.9.2 ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 10.0.0 

local packages:

@ionic/app-scripts : 3.2.4
Cordova Platforms  : ios 5.1.0
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.11.3 
Node       : v14.15.0
npm        : 6.14.8 
OS         : macOS High Sierra
Xcode      : Xcode 9.2 Build version 9C40b 

Package.json:

 {
  "name": "name",
  "version": "0.0.1",
  "author": "author",
  "homepage": "https://homepage.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": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "^7.2.10",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@grpc/grpc-js": "^1.1.7",
    "@ionic-native/app-availability": "^4.20.0",
    "@ionic-native/app-version": "^4.15.0",
    "@ionic-native/barcode-scanner": "^4.9.0",
    "@ionic-native/camera": "^4.7.0",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/file": "^4.20.0",
    "@ionic-native/file-path": "^4.7.0",
    "@ionic-native/fingerprint-aio": "^4.20.0",
    "@ionic-native/firebase": "^4.20.0",
    "@ionic-native/firebase-crashlytics": "^5.30.0",
    "@ionic-native/header-color": "^4.17.0",
    "@ionic-native/http": "^4.20.0",
    "@ionic-native/in-app-browser": "^3.1.0",
    "@ionic-native/ionic-webview": "^5.0.0",
    "@ionic-native/pin-dialog": "^4.20.0",
    "@ionic-native/push": "^3.14.0",
    "@ionic-native/social-sharing": "^4.15.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "^4.7.0",
    "@ionic-native/vibration": "^4.8.0",
    "@ionic/storage": "2.1.3",
    "angularfire2": "^5.4.2",
    "brmasker-ionic-3": "^1.5.3",
    "cordova-ios": "4.5.5",
    "cordova-plugin-appavailability": "^0.4.2",
    "cordova-plugin-headercolor": "^1.0.0",
    "cordova-plugin-inappbrowser": "^3.1.0",
    "cordova-plugin-ionic-webview": "^4.1.3",
    "cordova-plugin-pin-dialog": "^0.1.3",
    "cordova-plugin-splashscreen": "6.0.0",
    "cordova-plugin-statusbar": "^2.4.3",
    "cordova-plugin-vibration": "^3.1.1",
    "cordova-plugin-whitelist": "1.3.4",
    "crypto-js": "^3.1.9-1",
    "firebase": "^7.2.4",
    "ionic-angular": "3.9.2",
    "ionic-stepper": "^1.1.0",
    "ionicons": "3.0.0",
    "ngx-barcode": "^0.2.4",
    "ngx-qrcode2": "0.0.9",
    "onesignal-cordova-plugin": "^2.11.1",
    "rxjs": "^6.4.0",
    "rxjs-compat": "^6.4.0",
    "semver": "^7.3.2",
    "sw-toolbox": "^3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.2.4",
    "@types/node": "7.0.7",
    "cordova-android": "^8.0.0",
    "cordova-plugin-advanced-http": "^3.1.0",
    "cordova-plugin-androidx": "^3.0.0",
    "cordova-plugin-androidx-adapter": "^1.1.1",
    "cordova-plugin-app-version": "^0.1.12",
    "cordova-plugin-camera": "^4.1.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-filepath": "^1.5.6",
    "cordova-plugin-fingerprint-aio": "git+https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio.git#f8e5588011506b4a386cbfa16346cd6b5ab85349",
    "cordova-plugin-firebase-lib": "^5.1.1",
    "cordova-plugin-ionic-keyboard": "2.0.5",
    "cordova-plugin-x-socialsharing": "^5.4.1",
    "es6-promise-plugin": "^4.2.2",
    "phonegap-plugin-barcodescanner": "^8.0.0",
    "typescript": "3.2.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-vibration": {},
      "cordova-plugin-headercolor": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-pin-dialog": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-appavailability": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-camera": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-filepath": {},
      "cordova-plugin-file": {},
      "cordova-plugin-advanced-http": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-fingerprint-aio": {
        "FACEID_USAGE_DESCRIPTION": "Confirme sua digital"
      },
      "cordova-plugin-firebase-lib": {},
      "cordova-plugin-androidx": {},
      "cordova-plugin-androidx-adapter": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-ionic-keyboard": {},
      "phonegap-plugin-barcodescanner": {},
      "cordova-plugin-x-socialsharing": {
        "PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to function properly.",
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to function properly."
      },
      "cordova-plugin-splashscreen": {}
    },
    "platforms": [
      "ios"
    ]
  }
}
1 Like