Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOs build failing - UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined

Since yesterday, when I try to make a build for iOs it wont succeed and throw this error:

(node:3043) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined
    at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/lib/list-emulator-build-targets:54:45
    at Array.forEach (<anonymous>)
    at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/lib/list-emulator-build-targets:52:44
    at Array.reduce (<anonymous>)
    at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/lib/list-emulator-build-targets:50:57
    at Array.reduce (<anonymous>)
    at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/lib/list-emulator-build-targets:45:28
    at _fulfilled (/Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/node_modules/q/q.js:854:54)
    at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/node_modules/q/q.js:816:13)
(node:3043) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3043) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I've already tried cheking out a new project from git, removing and reinstalling modules, removing and readding the platform in ionic, I don't know what else I could try. Please, could someone give me some enlightenment on this issue?

Thanks in advance.

like image 898
jenesuispastom Avatar asked Sep 24 '19 13:09

jenesuispastom


2 Answers

toLowerCase is used in plugins/cordova-plugin-ios-localized-strings/scripts/add_supported_languages.js?

If yes, there the value is undefined.

Please, try running: ionic build --prod

If you face an error -> There is a problem in your code.

If you face no error -> The problem happens when cordova is bundling your app.

If that last option, execute from bash (not cmd): ionic cordova build ios --prod or try removing and adding your platform again.

-Best regards.

like image 109
1antares1 Avatar answered Sep 29 '22 23:09

1antares1


I started having this issue too all of a sudden today. Removing and adding the platform did not do it for it. To resolve it, I removed the iOS platform version 4.5.5 and installed the latest version of the platform version which seems to fix it.

So do this:

1) Remove the iOS Platform:

ionic cordova platform remove ios

2) Install the latest version of iOS Platform:

ionic cordova platform add ios@latest --save

The above installed version 5.0.1 for me. After this, running the command ionic cordova build ios did not show any errors.

like image 41
Neel Avatar answered Sep 29 '22 23:09

Neel