Failed to load iOS project file when running cordova via npm scripts (works for android)
I've got some npm scripts to make it easier to build and launch our android and ios apps. The android one is working great, but the ios one throws an error, but if I manually run the command it works. I'm guessing there is something in the ios builder / platform that is using the path of where I ran the script instead of pwd.
error message
Failed to load iOS project file. Maybe your Cordova version is not supported?
android command (working fine)
npm run build -- --mobile && pushd cordova/consumer && adb uninstall com.my.app && cordova prepare android && cordova run android && popd
ios command (throws error)
npm run build -- --mobile && ios-deploy --uninstall_only --bundle_id com.my.app && pushd cordova/consumer && cordova prepare ios && cordova run ios && popd
my work around
npm run build -- --mobile && ios-deploy --uninstall_only --bundle_id com.my.app && echo "to launch run: pushd cordova/consumer && cordova prepare ios && cordova run ios && popd"
This runs npm run build -- --mobile && ios-deploy --uninstall_only --bundle_id com.my.app
Then echos: to launch run: pushd cordova/consumer && cordova prepare ios && cordova run ios && popd
After the above runs if i simply copy/paste pushd cordova/consumer && cordova prepare ios && cordova run ios && popd it launchees without issue, but if npm runs it it fails with the error message above.
This message should be output by the plugin "cordova-hot-code-push-plugin", modify the code in the file "scripts/lb/iosWKWebViewEngineSupport.js" in this plugin as follows:
context.requireCordovaModule('xocde') ---> require('xocde')
Before that, you may need to install the xcode module under the plugin as follows:
npm install xcode --save