Unable to run expo project on iOS simulator - react-native

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

Related

react-native run-ios ends up with error 65 - cannot build

React-Native run-ios build error 65
I've tried many things. I did a pod install in the ios folder. I tried pod update. I tried restarting VScode and xcode. I tried restarting the computer. I tried running another react-native project successfully. I tried doing a gem instal cocoapods. I tried commenting out components. I don't know what else to try.
Simulator 11.1
Xcode 11.1
vscode 1.38.1

How to fix React/RCTBridgeDelegate.h' file not found

I created new project by react-native init.
but I can not run it.
gave me error React/RCTBridgeDelegate.h file not found.
react-native run-ios at terminal in mac
You are getting this error because the necessary cocoapods are not installed in the Xcode project
This is how you fix it
Navigate into your ios file in your terminal (cd > ios)
Run the command: Pod install
Navigate back to the root of your project and run it.
It should run just fine now. :)

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.

Expo React-Native iOS Simulator not working

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.

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