question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-native run-ios can not find any simulator

See original GitHub issue

Environment

React Native Environment Info: System: OS: macOS 10.14.2 CPU: (12) x64 Intel® Core™ i9-8950HK CPU @ 2.90GHz Memory: 6.76 GB / 32.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.0 - /usr/local/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 IDEs: Android Studio: 3.1 AI-173.4819257 Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: react: 16.6.3 => 16.6.3 react-native: 0.57.8 => 0.57.8 npmGlobalPackages: create-react-native-app: 1.0.0 react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7

Description

I have been facing an issue where ‘react-native run-ios’ can not start, regardless of the simulator I add to the --simulator argument. XCode has the correct location for the ‘command line tools’

I am always getting the error: Could not find iPhone X simulator

Error: Could not find iPhone X simulator
    at resolve (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)
    at new Promise (<anonymous>)
    at runOnSimulator (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
    at Object.runIOS [as func] (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
    at Promise.resolve.then (/Users/eric/.../swim/node_modules/react-native/local-cli/cliEntry.js:117:22)

Reproducible Demo

Installed XCode from scratch. Brand new ‘react-native new app’

‘react-native run-ios’ always complain about not finding the simulator, regardless of the --simulator option.

My temporary fix is to change: /node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js

line 42, to: if (!version.startsWith(‘**com.apple.CoreSimulator.SimRuntime.**iOS’) && !version.startsWith(‘tvOS’)) {

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:14
  • Comments:107 (6 by maintainers)

github_iconTop GitHub Comments

521reactions
tedicommented, Mar 26, 2019

It’s having issues doing the string search on the simulator version in node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js on this line: if (!version.startsWith('iOS').

I replaced it with includes as such: if (!version.includes('iOS') which seems to have solved the problem for me.

93reactions
osunnarvikcommented, Feb 5, 2019

I have the same issue here as well. When I changed to if (!version.includes(‘iOS’) && !version.includes(‘tvOS’)) { continue; }

all is well, since the prefix “com.apple.CoreSimulator.SimRuntime.” is included in the device-list, the pure check for startsWith fails for all simulators.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`react-native run-ios` returns Error: Could not find iPhone X ...
In Xcode: Go to Window then Devices and Simulators . Click the simulators tab. Click the + button on the bottom left corner...
Read more >
Issue with opening IOS Simulator | Apple Developer Forums
Hi, I am developing an App in React Native for this i need Xcode. However when i start my Expo Developer Tool Metro...
Read more >
Running On Simulator - React Native
Once you have your React Native project initialized, you can run npx react-native run-ios inside the newly created project directory. If ...
Read more >
react-native run-ios error could not find iPhoneX Simulator
A quick solution for this React Native error:error Could not find " iPhone X" simulator. Run this command to see available simulators :xcrun ......
Read more >
React-Native “Could not find iPhone X simulator” - Bram.us
One of my React Native projects recently decided to no longer launch any of the iPhone Simulator devices anymore. When running react-native ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found