Ionic capacitor run ios -l --external won't run (no error)

I’m having a weird issue with capacitor where when I try to run my app on an external device it doesn’t run.

The device I’m trying to run my app on is iPhone 12 / iOS 15.4.1 (been doing this for a long time without an issue)

I get no error and the last lines in console are:

[capacitor] :heavy_check_mark: Running xcodebuild in 14.71s
[capacitor] :heavy_check_mark: Deploying Foodie Syndicate.app to device-id-here in 854.58ms

[INFO] App deployed to device!

   Development server will continue running until manually stopped.
   
   Use Ctrl+C to quit this process

If I run it on a simulator then it does work correctly and if I run it directly from Xcode to the physical device it will also work but not when I try to run it on a physical device using ionic capacitor run ios -l --external.

I’ve checked the device ID and it is correct, what could be the problem here?

My ionic info:

Ionic:

Ionic CLI : 6.19.0 (/Users/mindaugas/.config/yarn/global/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 6.0.14

Capacitor:

Capacitor CLI : 3.4.3
@capacitor/android : 3.4.3
@capacitor/core : 3.4.3
@capacitor/ios : 3.4.3

Utility:

cordova-res : not installed globally
native-run : 1.5.0

System:

NodeJS : v17.7.2 (/Users/mindaugas/.nodenv/versions/17.7.2/bin/node)
npm : 8.5.2
OS : macOS Monterey

1 Like

Do you get any errors if you run native-run directly?

No. The command is finished after ~1sec. and that’s it.

Figured it out! It was NodeJS v17.7.2. I downgraded to v16.14.2 and now it is deploying correctly.

1 Like

I have a similar problem, where I get no errors. I tried to downgrade and upgrade node, but that didn’t solve the problem.
I also tried uninstalling and installing the ionic/cli again. It still doesn’t work.
My last line with verbose is:

ionic:lib:integrations:capacitor Getting config with Capacitor CLI: [ ‘config’, ‘–json’ ] +0ms

Did ionic capacitor run ios work for you? Because that also doesn’t work right now.

I found the error. For me it was that @ionic/cli version 6.20.2 livereload didn’t work with capacitor version 4.3.0. So when I downgraded to @ionic/cli 6.20.1 it worked again.

You also have to have node version v16.14.2. With node version v17.7.2 or v18.10.0, the error also occurs with ionic/cli version 6.20.1

Currently an issue being tracked on github: Capacitor run android not working in 6.20.2 · Issue #4912 · ionic-team/ionic-cli · GitHub

1 Like

Be sure to provide an update for us, @butaminas

I’ve been having this exact same issue the last couple of weeks and the only solution for me was to do what @calDion suggested - go back down to ionic 6.20.1 and node 16.14.2. This is a shame because I like to be on the same version of node as we use on Appflow for our release builds so it would be good to see this fixed.

Ionic CLI 6.20.2 had a bug that prevented ionic cap from working, that got fixed on 6.20.3, so you shouldn’t need to downgrade to 6.20.1 anymore.

Related to the node 18 issues, it’s better if you report the issue on Issues · ionic-team/ionic-cli · GitHub unless the problem is this one bug: -l --external Fails with Node 18 · Issue #4839 · ionic-team/ionic-cli · GitHub

1 Like

I was having an issue with this and it seems like it stemmed from a linting warning – not even an error, just a warning about a non-used import. Make sure your linter is free from… lint!

You saved me man!, was going mad over this. Thank you!

I upgraded capacitor-cli, and cococapods but it didnt work for me.

I solved it with

0- Before i start this procedure, i upgraded version of cocoapods from 1.13.x to 1.14.2 by using the following command, homebrew brew upgrade cocoapods

1- Delete DerivedData folder and capacitor-cordova-ios-plugins if exists
Screenshot 2023-10-29 at 01 10 27

2- Go to ios/App and delete Pods folder
Screenshot 2023-10-29 at 01 11 56

3- run pod install inside of ios/App

4- go to root folder which your project is located and run ionic cap sync

5- Better first test directly run this project in a simulator ionic cap run ios and choose a device.

6- If everyyhing works fine then try to run ionic capacitor run ios -l --external

Same issue, with simulator works fine. Haven’t tried yet, but next thing I’ll do is make sure both devices are on the same network, turn off any VPN connection.

If you are using nvm to install node, don’t forget to install also the @ionic/cli globally for the newly installed node version.
Eg.

nvm install v20.17.0
nvm alias default v20.17.0
npm install -g @ionic/cli

You can check if you have @ionic/cli globally installed with “npm ls -g”.