apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.15k stars 987 forks source link

Cannot read property 'toLowerCase' of undefined [ERROR] An error occurred while running subprocess cordova. #647

Closed daviddickson closed 4 years ago

daviddickson commented 4 years ago

Bug Report

Running ionic cordova build ios within a new, blank project does not work. This is a continuation of #642

Problem

When running ionic cordova build ios the following error occurs:

Cannot read property 'toLowerCase' of undefined
[ERROR] An error occurred while running subprocess cordova.

What is expected to happen?

The build should run to completion.

What does actually happen?

The build does not run completion.

Information

  1. Create a new Ionic 4 project using the 'blank' template.
  2. Add the ios platform using ionic cordova platform add ios.
  3. Upgrade cordova-ios to the latest version (5.0.1 at the time of this writing).
  4. Run ionic cordova build ios. The same TypeError appears.

Command or Code

Environment, Platform, Device

Version information

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.6.2
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 4 other plugins)

Checklist

dpogue commented 4 years ago

Cordova Platforms : ios 4.5.5

You are running cordova-ios 4.5.5, this is fixed in cordova-ios 5.0.x.

daviddickson commented 4 years ago

@dpogue I must be missing something. I ran npm install cordova-ios@latest and according to package.json it is at 5.0.1 - "cordova-ios": "^5.0.1". Am I updating the wrong thing?

brodybits commented 4 years ago

I ran npm install cordova-ios@latest […]

I think that will not work on a Cordova project.

I highly recommend that you start with another “blank” project, with a limited number of plugins, and do cordova platform add ios@latest or ionic cordova platform add ios@latest.

In case of continued problems, please give us a more exact set of commands that we have to do to install the Ionic CLI, create the project, add the plugins, and reproduce your issue. Most of us do not actively support use with Ionic.

daviddickson commented 4 years ago

@brodybits ionic cordova platform add ios@latest worked in a new blank project and in the current project I'm working on (after removing the platform first). Thanks!

brodybits commented 4 years ago

Thanks @daviddickson. I think this needs to be documented by the Ionic project.

brodybits commented 4 years ago

That your Ionic tool gave you old cordova-ios version indicates to me that you have an old version of Ionic CLI installed. I just tried the following steps:

and the following piece of output indicates to me that it does use cordova-ios@5, as required:

Using cordova-fetch for cordova-ios@^5.0.0

I highly recommend that you install recent version of Ionic CLI and ensure that you installed recent version of other tools such as Cordova CLI.

janpio commented 4 years ago

ionic (Ionic CLI) : 4.12.0 (/usr/local/lib/node_modules/ionic)

This is 4 months old.

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)

This is 9 months old.

MiguelGonzalezAravena commented 4 years ago

I have the same issue with a project. I have this error when i do ionic cordova build ios:

[...]
[16:20:48]  lint finished in 4.49 s 
> cordova build ios
Reading build config file:
Cannot read property 'toLowerCase' of undefined
[ERROR] An error occurred while running subprocess cordova.

        cordova build ios exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

My ionic info:

Ionic:

   ionic (Ionic CLI)  : 4.5.0
   Ionic Framework    : ionic-angular 3.9.8
   @ionic/app-scripts : 3.2.4

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, ios 4.5.5
   Cordova Plugins       : no whitelisted plugins (16 plugins total)

System:

   Android SDK Tools : 26.1.1 (/Users/_<<myUser>>_/Library/Android/sdk)
   ios-deploy        : 1.9.2
   NodeJS            : v10.16.3 (/usr/local/bin/node)
   npm               : 3.10.10
   OS                : macOS Mojave
   Xcode             : Xcode 11.0 Build version 11A420a
raghu5291 commented 4 years ago

@MiguelGonzalezAravena just remove the platform ios and then run below command ionic cordova platform add ios@latest as stated by @dpogue above it is fixed in cordova-ios 5.0.x

danielrf121 commented 4 years ago

Cordova Platforms : ios 4.5.5

You are running cordova-ios 4.5.5, this is fixed in cordova-ios 5.0.x.

Thanks!

ghost commented 4 years ago

Thanks @daviddickson you really saved me a hell lot of time

prateekchitransh1907 commented 4 years ago

Thanks man ! I was stuck for so long. @daviddickson

iurynogueira commented 4 years ago

@brodybits ionic cordova platform add ios@latest worked in a new blank project and in the current project I'm working on (after removing the platform first). Thanks!

Thanks, work here!

KenVega-Tekton commented 4 years ago

I was using node 6.3.1 and cordova 6.5.0 Once I tried to use ios@5.0.x I got an error asking for module cordova-common Then I tried to rebuild the whole cordova project with node 10.x and cordova 9.0.0 again with node and then I was able to use ios@5.0.x platform.

warning: I would suggest to make a backup for your current cordova build before rebuilding.

prat3ik commented 4 years ago

Updating ios to the latest worked for me~ 1) cordova platform remove ios // To remove existing ios lib. 2) ionic cordova platform add ios@latest// Update to latest

pratik-scotts commented 4 years ago

Or we can try these: cordova platform remove ios cordova platform add ios@latest

wiredlain commented 3 years ago

in my case, the problem was in the file 'platforms/ios/cordova/lib/list-emulator-build-targets' line 53 app.

if (device.name === deviceType.name.replace(/\-inch/g, ' inch') && device.availability) { when availability is doesn't exists.

i change the line for this one. if (device && device.name === deviceType.name.replace(/\-inch/g, ' inch') && device.isAvailable) {