Failed to load iOS project file when running cordova via npm scripts (works for android)
- Dominant language
- JavaScript
- Stars
- 967
- Forks
- 344
- Avg merge
- 8h 41m
- Merged PRs (30d)
- 9
Description
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.
Contributor guide
Research direction
No source file or test is named. Start by reproducing the npm script and comparing its working directory with the pasted interactive command, then trace the iOS project-loading entry point. Done means the same prepare and run commands work when invoked through the npm script, with a regression test if the relevant test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100