Expo React-Native iOS Simulator not working - react-native

Hello I'm facing a problem with Expo React-Native. Whenever I try to launch the iOS Simulator. I get this error:
Simulator is installed but is identified as 'com.apple.CoreSimulator.SimulatorTrampoline'; don't know what that is.
Simulator not installed. Please visit https://developer.apple.com/xcode/download/ to download Xcode and the iOS simulator. If you already have the latest version of Xcode installed, you may have to run the command `sudo xcode-select -s /Applications/Xcode.app`.
Screenshot of Expo Results
My NPM Version is 6.7.0
react-native-cli: 2.0.1
react-native: 0.57.1
Expo Version 2.11.9
Also I made sure my Command Line tools on Xcode is setup perfectly
Xcode CommandLineTools
Finally, I also tried to run the command sudo xcode-select -s /Applications/Xcode.app
Nothing works..

I had the same problem, fixed it by manually starting the simulator app before starting expo.
The app is located in /Applications/Xcode.app/Contents/Developper/Applications/Simulator.app

expo client:install:ios
This worked for me.

Manually opening the simulator first can help:
open -a Simulator
Then if using expo:
expo start
Finally click:
"Run on iOS simulator"

If it helps anyone else, the fix of opening the Simulator first was not working for me at first because I did not have command line tools installed. You can open xCode, go to preferences > locations > command line tools and if that is empty you'll need to install them. Once they are installed, expo start will give the same error as OP, but you can then use the open -a Simulator && expo start suggestion.

According to this thread What does com.apple.CoreSimulator.CoreSimulatorService do?, you can just execute the launch correctly the simulator.
killall -9 com.apple.CoreSimulator.CoreSimulatorService
Actually, it works to launch the simulator, but if I restart once the simulator, the problem is still here.
Update:
Apple provided a patch 10.2.1. After an update of XCode through the App Store, it seems working better. My simulator boots with an error, but after press "i" again in the terminal, it works correctly even if I restart the process.
Don't forget to update the latest version of expo-cli with npm install -g expo-cli

Simplest solution I have found; change your npm start script within the package.json file of your Expo project:
"start": "expo start", > "start": "open -a Simulator && expo start",

Yes you can fixed it temporarily by starting the simulator app before starting expo :
open -a Simulator; expo start
But the next time you open it, you have to run both commands again as well.
For now, you can aliasing start to open -a Simulator; expo start

Yup, additionally you have to give permissions every time you relaunch.. and because these are alerts.. the simulator takes forever to render. This is not an acceptable workflow. For now im just rendering on a device. Really hoping this gets fixed proper and soon.

🎉 I've been facing the same problem for a month, however I finally found a solution that worked for me:
Updated my Xcode to Version 11.1 ✨
Opened Xcode 11.1: (1) Double checked if "Xcode 11.1" was selected as my "Command Line Tool"; (2) Under the "Components" tab, I manually downloaded a simulator (iOS 12.2)
Updated Expo Client to #3.1.2 ✨
sudo npm install --unsafe-perm -g expo-cli
Updated Node.js from version 11.6.0 to 12.0.0
sudo npm install -g n
npm cache clean -f
Restarted my project & my simulator
npm start
✨ Which successfully launched my iOS simulator and built my project! ✨

Try to open the Simulator first from Xcode and then start Expo Metro.

For me I happen to learn that it requires all the three to make react native app run on the iOS simulator.
Xcode should be running
Simulator should be running
Expo Start and click on Run on iOS Simulator
It will then prompt on Simulator to install Expo Go for the first time and then would run app normally.
I was missing one or the other in my first two attempts to run the app on iOS Simulator.

Related

Expo won't start the simulator / emulator

I always used to start my Expo project by typing in the terminal expo start and then i (for iOS simulator). The day after iOS 16 got released, Expo started to behave differently. After running expo start it gave me a warning: This command is being executed with the global Expo CLI. Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421
To use the local CLI instead (recommended in SDK 46 and higher), run:
› npx expo start and after pressing i it threw the following error:
Error running xcrun simctl help: You may need to run sudo xcode-select -s /Applications/Xcode.app and try again.
XDLError: You may need to run sudo xcode-select -s /Applications/Xcode.app and try again.
Unable to verify Xcode and Simulator installation. After this I killed the terminal and in a new one I decided to follow the command it gave me in the warning (after running expo start). I ran npx expo start and then i and it threw me a new error which was:
Unable to run simctl:
Error: xcrun exited with non-zero code: 72
CommandError: xcrun is not configured correctly. Ensure sudo xcode-select --reset works before running this command again., but this time it didn't gave me a warning before pressing i. I also tried to run the commands shown in the errors and re-run the app, but still the same errors were thrown. I updated my OS, XCode and also deleted and cloned the project again so i could re-install dependencies just in case something was wrong with them.
I have attached the GitHub repo link of one of my projects so you can test it as well. It's not just this project, it's all of the projects I use Expo, even the new ones won't start.
If anyone has any idea how to fix this and why this happens, I would really appreciate it :)
Uninstalled and re-installed Expo globally. Updated the simulator to iOS 16 and opened the simulator before running expo start. It works as it did before.

Unable to run expo project on iOS simulator

I created an expo project and I am trying to run it on both an iOS and an android simulator. Everything works fine on the android simulator but not on the iOS simulator. I am getting the following error:
Error installing or running app. Error: ENOENT: no such file or directory, mkdir '/Users/.../.expo/ios-simulator-app-cache/Exponent-2.16.0.tar.app'
In advance thanks
For some reasons the /Users/.../.expo/ios-simulator-app-cache/ install on my computer was version 25 and my project was expo version 26 that is why it could not find the directory. To solve the problem I ran sudo rm -rf ~/.expo to remove the expo on my computer then I just retried it and it worked

Expo Web starts Automatically

When I run the command "yarn start", the expo web starts automatically, and even if I open the expo client app on my iPhone the link on my app takes me to Safari and opens up a webpage. How can I open the app on expo CLI and not on my phone's browser (Safari)?
I have also tried the command "expo start --ios" and when I run it I get the error
"Simulator not installed. Please visit
https://developer.apple.com/xcode/download/ to download Xcode and the
iOS simulator. If you already have the latest version of Xcode
installed, you may have to run the command sudo xcode-select -s /Applications/Xcode.app".
I don't want to run the app on a simulator or phone's browser instead on my phone using expo client
I was dealing with this issue also hoping someone would find a solution. However, I have found the solution that worked for me at least. What I did is installed the react-native cli (reinstall if already installed) and then ran npm install in my project and it went back to normal and stopped going on my phones browser. Search documentation regarding this to install those things. I installed them in the order stated and it worked.
try update your expo-cli version and see if it helps. npm install -g expo-cli
Below is my situation,
By default Expo uses yarn. I installed any new dependencies using npm, then by default expo is built with web.
Solution:
use yarn always to install new dependencies or
use npm install once to install and now expo will build project with android or ios
On Linux try with sudo:
sudo npm install -g expo-cli
Then install packages and run:
yarn
Then run the following to clear cache and start expo:
expo start -c
This issue usually happens when you install a new npm package. You can either uninstall/reinstall the package or run the above three steps and solve your problem.

Failed to load bundle - Could not connect to development server

I've been looking for a solution to this issue for a day now but couldn't fix it.
I have not used react native for a month when everything was working fine.
Now, if I try to run an existing project that used to work (react native 0.59.5) or a brand new project (react native 0.59.9) with the iOS simulator on my mac, I get the error:
Failed to load bundle - Could not connect to development server
Any idea how I can fix this?
Ok found the issue. Was thinking it might be watchman related issue and wanted to use the command brew reinstall watchmanto reinstall it. By running this command, I found an error
Error: Xcode alone is not sufficient on Mojave. Install the Command Line Tools: xcode-select --install
Looks like the command line tools for xCode was not available anymore.
I launched the command xcode-select --install and then reinstalled watchman just in case. It is now working!
Couldn't connect to development server error
This error is received when the metro bundler isn't running in port 8081. To start the bundler, from project folder run:
npm start
Now, try reloading your app (ctrl + R for iOS / r+r for Android).
Also, check your terminal in case the project failed initial build due to some error.

react-native run-android not working on ubuntu 16.04

i have a problem with react native in ubuntu, i have installed,
java jdk 8 (both javac --version) as well as echo $JAVA_HOME gives the proper output.
I have also installed android studio and set the android environment variables as well as the tools and echo $ANDROID_HOME gives output of the sdk location.
I have also installed gradle version 4.4.
I am unable to start the android app using react-native run-android. can any one let me know if i have missed something during installation.
And react-native as well as android studio works fine as I am currently using react-native start to start the metro builder as well as the other react-native cli commands. also android studio and gradle is also able to generate debug as well as release apks with no problems.
The error i get,
Scanning folders for symlinks in /home/igate-naveed/Documents/ReactNative/mobile-app-android/node_modules (16ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
First of all you need to create a project like this:
react-native init myProjectName
Then, start an emulator from Android Studio... Afterwards:
npm install && npm start
in your project directory, and from another terminal, inside your project directory, run :
react-native run-android
Is this working?
Instead of using the npm install manager, I used yarn and it worked for me. In your project directory, just do:
(project-directory)$ yarn
Update the gradle version.
Create new project:
react-native init projectname
Uninstall the npm pack.
Reinstall the npm pack again.
npm start
react-native start
react-native run-android