moeru-ai/airi · error · Error

No devices or simulators found. Connect a device, start a…

Error message

No ${platform} devices or simulators found. Connect a device, start a simulator or emulator, or pass --target explicitly.

What it means

When no --target is given, resolveCapRunArgs lists targets via `cap run <platform> --list --json`, picks the first entry with an id, and throws this error if none is found. It means Capacitor can see no runnable iOS simulator or Android device/emulator for that platform.

Solutions

  1. Start an Android emulator (emulator -avd <name> or Android Studio Device Manager) or boot an iOS simulator (xcrun simctl boot 'iPhone 16 Pro') and retry
  2. Connect a physical device over USB and accept the debugging/adb authorization prompt
  3. Or bypass discovery entirely by passing the target: `cap-vite -- ios --target "iPhone 16 Pro"` (hasCapacitorTargetArg then skips auto-pick)
  4. Verify discovery works first: `npx cap run ios --list --json` should list at least one id

Example fix

# before
$ cap-vite -- ios   # Error: No ios devices or simulators found...

# after
$ xcrun simctl boot 'iPhone 16 Pro'
$ cap-vite -- ios
# or skip discovery:
$ cap-vite -- ios --target 'iPhone 16 Pro'
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check device availability before launching
const list = await x('cap', ['run', platform, '--list', '--json'])
const targets = JSON.parse(list.stdout) as Array<{ id?: string }>
if (!targets.some(t => t.id))
  throw new Error('No devices available — start a simulator/emulator first')

Try / catch

try {
  await runCapVite([], ['ios'])
}
catch (err) {
  if (err instanceof Error && err.message.includes('devices or simulators found')) {
    // guide the user: boot a simulator or pass --target explicitly
    promptDeviceSetup()
  }
}

Prevention

When it happens

Trigger: Running `cap-vite -- ios` with no booted simulator (xcrun simctl list shows none booted), `cap-vite -- android` with `adb devices` empty, or the capacitor CLI failing silently so the target list comes back empty.

Common situations: Fresh machine where no emulator/simulator was started; Android emulator closed or ADB unauthorized; CI runner without virtual devices; Xcode first-run without installed runtimes.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/cc2e9a346c7c9715. Report an issue: GitHub.

Appendix: source

Thrown at packages/cap-vite/src/native.ts:155

  let target: string | undefined
  if (platform === 'ios') {
    target = env.CAPACITOR_DEVICE_ID_IOS
  }
  else if (platform === 'android') {
    target = env.CAPACITOR_DEVICE_ID_ANDROID
  }

  if (!target) {
    if (!platform) {
      return capArgs
    }

    const targets = await listTargets(platform)
    target = targets.find(device => device.id)?.id
  }

  if (!target) {
    throw new Error(`No ${platform} devices or simulators found. Connect a device, start a simulator or emulator, or pass --target explicitly.`)
  }

  return [platformArg, '--target', target, ...rest]
}

export function pickServerUrl(server: Pick<ViteDevServer, 'resolvedUrls'>): URL {
  const url = server.resolvedUrls?.network?.[0] ?? server.resolvedUrls?.local?.[0]

  if (!url) {
    throw new Error('Vite did not expose a reachable dev server URL.')
  }

  return new URL(url)
}

export function shouldRestartForNativeChange(file: string, platform: CapacitorPlatform, cwd: string): boolean {
  const absoluteFile = resolve(cwd, file)
  const platformRoot = resolve(cwd, platform)

View on GitHub (pinned to 677329427f)