-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error Could not find iPhone X simulator #418
Comments
I'm using Xcode |
Also, make sure you have the latest CLI (so remove |
here's with --verbose info Found Xcode workspace wellhaux.xcworkspace
error Could not find iPhone X simulator
debug Error: Could not find iPhone X simulator
at runOnSimulator (/Users/devionvillegas/Developer/NEXTGEN/wellhaux/node_modules/@react-native-community/cli/build/commands/runIOS/runIOS.js:131:11)
at Object.runIOS [as func] (/Users/devionvillegas/Developer/NEXTGEN/wellhaux/node_modules/@react-native-community/cli/build/commands/runIOS/runIOS.js:96:10)
at Promise.resolve.then (/Users/devionvillegas/Developer/NEXTGEN/wellhaux/node_modules/@react-native-community/cli/build/cliEntry.js:152:22)
at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:52:5)
at Function.Module.runMain (internal/modules/cjs/loader.js:880:11)
at internal/main/run_main_module.js:21:11 |
Deleted my lock file and reran npm install. This is the top of the @react-native-community/cli/package.json {
"_from": "@react-native-community/cli@^1.2.1",
"_id": "@react-native-community/cli@1.9.7",
"_inBundle": false,
"_integrity": "sha512-3Fw0TxB8fOVKD51kK9NN/SIonkvl8iCuUGb01RuzsrnMS76Wiu5JY3H7NhhPdvxFrrqa3vgBqJWRowAxbGJqJg==",
"_location": "/@react-native-community/cli",
"_phantomChildren": { So which version do I have? 1.2.1 or 1.9.7? |
You have 1.9.7 now which is good. Still happening? |
Yeah issue still exists. Also forgot to mention that building from Xcode works. That's why iPhone XR is booted in the cli output above. Just weird that the cli broke down on me. Another repro could be to download the new xcode beta. I regret doing it now but that could be the root cause |
Oh, that's weird, because your envinfo shows Then you may hit this: #414 (will make a release soon) |
Yeah I've uninstalled the beta and wiped all the related xcode files before reinstalling 10.2. Just weird that the issue still exists when last week I had downloaded xcode 10.2 and everything was fine. |
Can you try if applying that diff in your node_modules helps? |
That pull request makes sense though and might be the solution. Do we know what causes it to persist in my case though? I do remember when I tried to delete xcode files following this forum post (https://forums.developer.apple.com/thread/110227) I couldn't and maybe the "issue" got persisted on to my machine Couldn't delete these with sudo |
You could probably delete them (if you're sure about that) in Safe Mode. Apple prevents deleting some of the files in regular mode |
That diff is the solution. Works now. |
Thanks! I'll close the issue then |
Once I have more time I'll try and reproduce this whole issue with a mac VM. Pretty sure downloading the beta caused this. |
Released 1.9.8 with the fix |
I realize this is closed, but given the similarity of the error messages, it seemed appropriate to post this here, rather than as a new issue, though I can do that if it's preferable... I just encountered this error with xCode 10.3 and react-native-community 1.10.0. The "verbose" has changed slightly: debug Error: Could not find iPhone X simulator |
+1 this recocurring for me as well, probably caused by a recent apple update |
Ah, Xcode breaking things all the time :D PRs welcome, as I'm not on Xcode 12.3 yet (and seeing folks having their simulators gone and not able to start, I'm not gonna do it yet) |
Debugged a bit into this. I think the CLI does everything correctly, xcode is reporting the simulator as unavailable, see @thymikee Thanks for the quick response though! |
@jasonivers have you tried what @Pita did? |
A reboot does seem to have fixed it. I encountered the issue as I was trying to do one last build before signing off yesterday, or I probably would have rebooted myself. Either way, it appears a reboot is necessary, and then it is fixed. |
I have still the above described problem - also tried already to change all the proposed lines in node_modules/@react-native-community/cli/build/commands/runIOS/findMatchingSimulator.js Nothing seems to be working. |
Rebooting did not solve this for me. Turns out that the Xcode Beta was set as the current command line version of code. Running
fixed it for me. |
Tried @nickcurran's approach, didn't work. Rebooted, didn't work. I installed XCode 11 beta 5, which is when the problem started. |
I tried the above and nothing seemed to work. The following command worked for me. |
Problem There is no iPhone X! Run Simulator by itself, in the top menu, look under Hardware, Device, iOS 13.0. You will see there is:
When you execute run-ios, react-native is designed to match a requested device. The internally hard coded default is iPhone X. The function that tries to match the requested device is in:
This function is designed so you can give it a device, and an optional version number. If the given device and version cannot be found, it will return a match using the first device in the list by default. But... in reality, the first device is a watch, and any watch is excluded from matching, so this function will return null. Solution Run Simulator first by itself, as described above, and make a note of which iPhone or iPad you want. Then pass this name as an optional argument the the run-ios command line command as follows:
Also answered here: |
When I run Apparently, iPhone X is not available on the iOS 13.0 simulators |
Apparently iPhone X is not available on the iOS 13.0 simulators, but you can easily add it by going to xcode and add it manually, once you add it there, run the "react-native run-ios" command again and it works. |
@carloshuerta |
Adding an iPhone X simulator through the command-line solved the issue for me, as I couldn't find an iPhone X simulator to install in the GUI on Xcode 11. Here is the command-line code: /Applications/Xcode.app/Contents/Developer/usr/bin/simctl create "iPhone X" com.apple.CoreSimulator.SimDeviceType.iPhone-X com.apple.CoreSimulator.SimRuntime.iOS-13-0 |
react-native : 0.57.8 update code:
change the virtual machine version to iphone8 |
react-native version "<60.0.0" which resolve "@react-native-community/cli" => "^1.0.0" is not compatible to Xcode 11. Xcode simulator list format is not compatible to "@react-native-community/cli@^1.0.0" 1 solution is using "resolutions" in package.json, "resolutions": {
"@react-native-community/cli": "^2.8.3"
}, Or, patch every time for |
i update my package.json |
I solved by upgrading to react-native 0.60 |
@methuz react-native 0.61 was released earlier today so it's downgrading if you're starting today with .60 |
Hi All, I found other solution without changing any source code in node_modules directory.
if you need any screenshots how to do that just let me know. This is my first comment in github by the way so congrats me :) Thank you. |
With 0.61 and Xcode 11, my fix is just adding a script in package.json in the
So you can run But the real solution is to stop hardcoding in React Native Cli and always use whatever was the last used simulator from Xcode. |
@ilkinnamazov epic first comment! Congrats! |
react-native : 0.57.8
|
This fixed the error for me.
|
Expanding on @programmer-yang's workaround, react-native cli relies on the output of
to
See 2f24a8c for the corresponding fix in this repo. Depending on your react-native version, you might also need to apply 08fd511 and add "iPhone X" to the list of known simulators as per @jeffcousins' comment above. |
@thymikee your simple solution worked for me! Thanks 💯
|
Yes! This worked with a bare expo project. Thank you! |
You can add a simulator in Xcode->Window>Device & Simulator. Go to the simulator tab and add a simulator. Once done, on command prompt run > react-native run-ios --simulator "your added simulator name" |
Please update the |
I have RN-cli vesion 2.0.1 and I am still getting this error. |
@SirCameron |
@thymikee so should I install i've removed react-native-cli globally and from the project. |
Please follow the instructions on the page I linked in my comment :) |
@thymikee I did.
is the output. It is an older project using RN 0.59.8. |
I think you didn't. Here's the latest version: https://www.npmjs.com/package/@react-native-community/cli/v/1.12.0. If you have troubles editing the lock file, remove it and install dependencies again. |
Environment
Description
Not related to
facebook/react-native#21824
facebook/react-native#23282
as they have older versions of react-native. 59.9 doesn't even have the files they mentions because this repo now handles it.
Since 59.9 and upgrading to xcode 10.2
react-native run-ios
always produces an error. I've tried reinstalling simulators and even xcode itself many times now. I've also heard frojm many people that updgrading to xcode 10.2 produces this error as well.Reproducible Demo
A good repro is completely uninstalling xcode then reinstalling it, start a new project, then you should get the error.
The text was updated successfully, but these errors were encountered: