ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.14k stars 1.01k forks source link

bug: npx cap run ios not working #7149

Open rricamar opened 10 months ago

rricamar commented 10 months ago

Bug Report

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.6.0
  @capacitor/core: 5.6.0
  @capacitor/android: 5.6.0
  @capacitor/ios: 5.6.0

Installed Dependencies:

  @capacitor/android: 5.6.0
  @capacitor/cli: 5.6.0
  @capacitor/core: 5.6.0
  @capacitor/ios: 5.6.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Platform(s)

iOS

Current Behavior

When I try to run npx cap run ios it doesn't work/provide any information about the given error:

✔ Copying web assets from www to ios/App/App/public in 712.08ms
✔ Creating capacitor.config.json in ios/App/App in 2.96ms
[info] Inlining sourcemaps
✔ copy ios in 735.57ms
✔ Updating iOS plugins in 772.77μs
✔ Updating iOS native dependencies with pod install in 6.53s
✔ update ios in 6.65s
[error] native-run failed with error

        More details for this error may be available online:
        https://github.com/ionic-team/native-run/wiki/Android-Errors

Expected Behavior

npx cap run ios should deploy the iOS project into one of the simulators.

Code Reproduction

Reproduced in a fresh capacitor installation, no minimal sample is required.

Other Technical Details

npm --version output: 10.2.5

node --version output: v20.10.0

pod --version output (iOS issues only): 1.14.3

Additional Context

I suspect that native-run is not able to find any simulator. In another Ionic project that I have, the information that the Ionic wrapper provides is more specific (ionic cap run ios --verbose):

# ionic cap run ios --verbose
  ionic:lib Terminal info: { ci: false, shell: '/bin/zsh', tty: true, windows: false } +0ms
  ionic:lib CLI global options: { _: [ 'cap', 'run', 'ios' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +2ms
  ionic:lib:project Project type from config: vue-vite (vue-vite) +0ms
  ionic:lib:project Project details: { context: 'app', type: 'vue-vite', errors: [], configPath: '/Users/rubensopra/zurich/capacitor/zurich-capacitor-ionic-vue/ionic.config.json' } +0ms
  ionic Context: { binPath: '/Users/rubensopra/.nvm/versions/node/v20.10.0/lib/node_modules/@ionic/cli/bin/ionic', libPath: '/Users/rubensopra/.nvm/versions/node/v20.10.0/lib/node_modules/@ionic/cli', execPath: '/Users/rubensopra/zurich/capacitor/zurich-capacitor-ionic-vue', version: '7.1.5' } +0ms
  ionic:lib:integrations:capacitor Getting config with Capacitor CLI: [ 'config', '--json' ] +0ms
  ionic:commands:capacitor:run Getting native targets for 'ios' with Capacitor CLI: [ 'run', 'ios', '--list', '--json' ] +0ms
[ERROR] No devices or emulators found
  ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
  ionic:utils-process onBeforeExit handler: running 0 functions +0ms
  ionic:utils-process processExit: exiting (exit code: 1) +0ms

But, according to xcrun simctl list:

-- iOS 17.0 --
    iPhone 14 Pro Max (579428AA-BEB8-4415-A6AB-D22423181C35) (Shutdown) 
    iPhone 15 (E270B4F0-E089-45E8-820E-8563A2D27450) (Booted)

Note: If I open the native iOS project by running npx cap open ios and I run directly on the given simulator, it works fine.

dirkkelderman commented 2 weeks ago

Hey, we're running in to the same error at this moment. Did you find any solution?

rricamar commented 1 week ago

Hey, we're running in to the same error at this moment. Did you find any solution?

Hi @dirkkelderman, sorry for the late response.

In the end, it was a problem with my Xcode installation. It is more likely to happen if you have had various versions or have been playing intensively by removing and adding simulators.

Some workmates with a fresh Xcode installation had it working without any problems. Anyway, at least for me, I prefer manually to launch the app from the Xcode, since it has all the logging and editor features, giving the developer more overall control.

The issue got completely ignored by the Capacitor team 😢 so I hope it helps 🙏