Build/emulation errors: list-emulator-build-targets Cannot read property 'toLowerCase' of undefined

Seems like Xcode updated itself to 11 last night. Now both build & emulation is not working.

Using both these commands gets the same error:

ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0" --prod --release
ionic cordova emulate ios -l -c -s --target="iPhone-X,"  -- --buildFlag="-UseModernBuildSystem=0"

Error message below:

[cordova]  Cannot read property 'toLowerCase' of undefined
[cordova]  TypeError: Cannot read property 'toLowerCase' of undefined
[cordova]      at /Users/*****/platforms/ios/cordova/lib/list-emulator-build-targets:54:45
[cordova]      at Array.forEach (<anonymous>)
[cordova]      at /Users/*****/platforms/ios/cordova/lib/list-emulator-build-targets:52:44
[cordova]      at Array.reduce (<anonymous>)
[cordova]      at /Users/*****/platforms/ios/cordova/lib/list-emulator-build-targets:50:57
[cordova]      at Array.reduce (<anonymous>)
[cordova]      at /Users/*****/platforms/ios/cordova/lib/list-emulator-build-targets:45:28
[cordova]      at _fulfilled (/Users/*****/platforms/ios/cordova/node_modules/q/q.js:854:54)
[cordova]      at /Users/*****/platforms/ios/cordova/node_modules/q/q.js:883:30
[cordova]      at Promise.promise.promiseDispatch (/Users/*****/platforms/ios/cordova/node_modules/q/q.js:816:13)
1 Like

I have been getting the same error.
I update cordova-ios too, but still encountered the same issue.

Sorry to reply. But I managed to fix it.

So before re-adding the platform remove ios as so:

ionic cordova platform rm ios
ionic cordova platform add ios@latest

The @latest fixed it for me. Before I wasn’t using that.
You’re cordova-ios version at this time of writing should be ios 5.0.1.
You can check this by doing “ionic info” and looking under the Cordova Platforms section.


Confirmed. Removing platform and re-adding with @latest works!

1 Like


We have tried this but get the following error when running the build:

Error: Cannot find module '/platforms/ios/cordova/node_modules/cordova-common'

Current ionic info is:


   Ionic CLI          : 5.4.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.6
   @ionic/app-scripts : 3.2.3


   Cordova CLI       : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 3.1.2, (and 18 other plugins)


   cordova-res : not installed
   native-run  : not installed


   ios-deploy : 2.0.0
   ios-sim    : 8.0.2
   NodeJS     : v10.12.0 (/usr/local/Cellar/node/10.12.0/bin/node)
   npm        : 6.5.0
   OS         : macOS Mojave
   Xcode      : Xcode 11.0 Build version 11A420a

Do you have any suggestions?


I would attempt to do the following:

npm uninstall -g cordova
npm install -g cordova@latest
1 Like

Thank you, this solved my issue after 1 week of no luck building for iOS.

Installing Cordova 9.0 causes issues with plugins. Cordova CLI 8.1.2 with iOS 5.0.1 seems to be the right combo.

replace following code inside platfrom/ios/cordova/lib/list-emulator-build-targets

current code-------
if ( ===, ’ inch’) &&
device.availability.toLowerCase().indexOf(‘unavailable’) < 0) {
new code-----------
if( === || ===, ’ inch’))
if (device.isAvailable ||(device.availability && device.availability.toLowerCase().indexOf(‘unavailable’)<0)) {