react-native: out of box react native 0.71.1 failed run-ios
Description
i created a react native app with npx react-native init
, i did not change anything inside the app. however, run-ios command failed for me out of the box
1st time i run it, the run-ios command throws an error:
error Failed to install the app on the device because we couldn't execute the "ios-deploy" command. Please install it by running "npm install -g ios-deploy" and try again.
after i install the ios-deploy
, I got this generic error:
info Found Xcode project "reactNative71.xcodeproj"
info Found booted Emily’s MacBook Pro, iPhone 12
info Building (using "xcodebuild -project reactNative71.xcodeproj -configuration Debug -scheme reactNative71 -destination id=5B84EC9C-0F31-5666-B1D7-6FE2FB1A8089")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 70. To debug build logs further, consider building your app with Xcode.app, by opening reactNative71.xcodeproj.
Version
0.71.1
Output of npx react-native info
System: OS: macOS 12.6 CPU: (16) x64 Intel® Core™ i9-9980HK CPU @ 2.40GHz Memory: 124.93 MB / 64.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.13.0 - ~/.volta/tools/image/node/18.13.0/bin/node Yarn: 1.22.10 - ~/.volta/bin/yarn npm: 8.19.3 - ~/.volta/tools/image/node/18.13.0/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 1.8.0_292 - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.1 => 0.71.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
- create a react native app using
npx react-native init
- run
npm run ios
Snack, code example, screenshot, or link to a repository
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 15
- Comments: 35 (1 by maintainers)
@tatetoussaint In the end, i am able to run this command. a couple of issues i ran into:
pod install
failed due to an incompatible ruby version. however, i upgrade ruby usingrbenv
: https://github.com/rbenv/rbenv.however, i could run the command with udid flag: https://reactnative.dev/docs/running-on-simulator-ios#specifying-an-udid
xcrun simctl list
npm run ios --udid=...
ornpx react-native run-ios --udid=..
As this is a top result for this error, it may be worth noting - this error can also appear if you’re trying to load a simulator with a real device plugged in. The solution is simply to unplug the real device, run
npx react-native clean
, and try again.I was facing this error
This worked out for me:
cd ios && pod deintegrate
pod install
Then go ahead and rerun your project
I was having this problem when I was trying to run my app in the simulator with this command:
But I also have an personal device, also an iPhone 14 Pro, that is connected in the same network where I do my development and this iPhone is paired with Xcode through wifi.
This problem was happening around 50% if I tried to run on the simulator, but when I tried to run on a different type of simulator that is different from my real device, like
--simulator='iPhone SE'
, this problem never happens. This problem also didn’t happen when I unpaired my real device from Xcode.It seems that even though I pass the parameter
--simulator
, sometimes React Native still tries to run the app on a real device with the same name if it finds one paired in the development computer.One way to bypass this problem without having to unpair our device, is to use the
--udid
parameter instead of--simulator
.I encountered this issue after running my app on an actual physical device connected thru USB (I also paired my iPhone 15 with my Macbook). I resolved it by unpairing my physical device in Xcode.
Go to Manage Run Destinations… and unpair your physical device
The same.
Every two months I do a test build of a new version of React Native, and every two months I don’t want to upgrade from version 0.68.5
All build since 0.69 were broken somewhere and you need to spent a lot of time to start using it.
It doesn’t worth it.
Still facing the same issue on
0.71.3
, specifying--simulator
doesn’t really work for me whereas--udid
can launch the desired iOS simulatorios-deploy
already installed if that mattersExact path to your solution -
Product
->Destination
->Manage Run Destinations
why you guys need workaround, as the error shows:
Just install
npm install -g ios-deploy
, and try again, it worked for meThis issue is still happening on RN
0.71.4
I usednpx
to create the init template. This is unbelievable. 😓For me I was upgrading from from 0.69.7 to 0.71.2. I’ve deleted node modules and reinstalled dependencies. Also deleted Pods folder and ran pod install. It got rid of the error.
This is the second Saturday I wasted trying to upgrade from 0.70.6 to 0.71+ (this time 0.71.2). Issue still persists even if I use -udid parameter to specify a device ID because Metro cannot find any connected app after the build. As the OP mentioned, this is not only an upgrade issue but also creating a new RN project gives the same error.
Edit: I’ve been able to resolve the problem Metro doesn’t recognize the device by running the following :
adb reverse tcp:8081 tcp:8081
However, “Unable to find a destination matching…” issue when I run “yarn ios” issue is still there
Make sure latest ios-deploy package installed
e.g.
npm install -g ios-deploy
(add sudo if you need to)Also check which device it is trying to find. Check if it’s attempting to install on Macbook and not the iphone, which you can resolve by installing to iPhone. Instructions:
xcrun xctrace list devices
to get device namenpx react-native run-ios --device {insert device name }
device name from list devices. If whitespace in name, you need to escape (perhaps\
)May need to deintegrate pods and re-install:
cd ios && pod deintegrate
pod install