CordovaError: Promise rejected with non-error: ‘xcode-select: error: tool \’xcodebuild\’ requires Xcode, but active developer directory \’/Library/Developer/CommandLineTools\’ is a command line tools instance\n’

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Okay, so it looks like you’re having some trouble trying to run your Apache Cordova app on your iPhone. No worries! This blog post should get you pointed in the right direction.

First, if you happen to be receiving this CordovaError regarding xcode-select try installing this one dependency before attempting to run the app again on your device:

$ npm install -g ios-deploy

This is what the Official Cordova documentation suggests doing. However, this actually didn’t work for me for whatever reason. Luckily, I was able to install ios-deploy using brew instead, so maybe you should try that:

$ brew install ios-deploy

Now even though you should have all of the required dependencies installed (assuming your ran a traditional hello, world with swift and Xcode before installing Cordova), you may still find that you are running into the same error. The next step towards my eventual solution was running the following command to fix xcode-select:

$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

We’re getting closer. But I happened to next encounter an error message that read something like…

error: Signing for “HelloCordova” requires a development team. Select a development team in the Signing & Capabilities editor. (in target ‘HelloCordova’ from project ‘HelloCordova’)

The last step you need to take is to log in to developer.apple.com to figure out your developmentTeam identifier so you can set the developmentTeam flag when you go to run the app. This should fix the above error message. The developmentTeam identifier is located next to your name when you log in to developer.apple.com up in the top right hand corner of the website.

Last, run the app while remembering to set the necessary flags:

$ cordova run ios --device --developmentTeam="XX34TU9917" --automaticProvisioning=true

P.S. I made up the XX34TU9917 developmentTeam, so make sure you use your actual developmentTeam identifier found at developer.apple.com.

 

topherPedersen