Setting up react-native development environment at M1 Macbook - ios

Setting
os : Big Sur 11.1
homebrew : 2.7.1
node : 14.15.4
watchman : 4.9.0
Xcode : 12.3
cocoapods : 1.8.4
npx react-native init AwesomeProject
cd AwesomeProject
npx react-native start
cd AwesomeProject
npx react-native run-ios
result(err)
enter image description here
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AwesomeProject.xcworkspace.
until npx react-native start there's no error
but npx react-native run-ios doesn't work.
I don't get what the problem is. Is Xcode version too high? please help
and how can I build AwesomeProject with Xcode app?. I tried but it failed too.

go to applications and right click on Xcode.app. select the get info. fill the check box of open using Rosseta.if yo want to run iOS with terminal do the steps for terminal.app as well.

Related

failure to install cocoapods when initializing a react-native project

I'm currently running macOS Catalina 10.15.6 and XCode 12.4. I'm trying to create a react native ios app and I'm on the command line running "react-native init Focus" where Focus is the name of my app.
When setting up the app, I get the error "(node:11768) UnhandledPromiseRejectionWarning: Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template"
I try to run "cd ./Focus/ios && pod install" which fails, and I have also tried "sudo gem install cocoapods" and "brew install cocoapods" which all fail.
I cannot get past this setup phase of the project.
Fire below code for the setup Project.
npx react-native init ( Your Project Name)
Above code set up your project. And then open your project in IDE which you use for business coding and follow these steps.
Start your react native server by hit the following code
npx react-native start
For the run in iOS do the following steps
cd ios
pod install
cd ..
npx react-native run-ios
Or also you can directly run from Xcode after the third step. You do not need to hit the 4 setup

How to run `npm react-native run-ios` after upgrading mac os and upgrading xcode?

I picked up a react-native project from 2018. I was able to get the app to work in a simulator by typing npm install; npx react-native run-ios on a 2012 mac mini that had Xcode 9.0 installed.
However, the iPhone 11 was not available from the list of simulators. I read that I needed Xcode 11+ to get iPhone 11 simulator. So i upgraded my mac mini from OS 10.13 to OS 10.15, then I upgrade Xcode to version 12.0.
I loaded up the new Xcode and entered my Apple ID. I then went to terminal and typed npx react-native run-ios, but I got the error:
`instruments` is now deprecated in favor of 'xcrun xctrace' (see `man xctrace` for more information on its replacement)
Could not find iPhone 6 simulator
So then I ran the command rm -rf node_modules; npm install;, but then I got the error:
npm ERR! error: pathspec 'master' did not match any file(s) known to git
And trying to run npx react-native run-ios gives the error:
Command `run-ios` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.
How do you make npx react-native run-ios to work?
i think your project choose IP6 is default simulator, to change it,
Clone your project, in package.json change
"ios": "react-native run-ios --simulator="iPhone X""
then run : yarn ios
if not, open your project "yourproject.xcworkspace" with Xcode, and run it.
if the error persists, show your package.json for everyone to consider

How to make sure expo knows SDK is installed in my laptop

I am currently making a react native app and have installed expo but I am getting the error below in the image. I have SDK(29) in my device but how do I make sure that expo knows it.
You don't seem to have made Expo a project.
Did you ran react-native init ??? If yes, it is not an Expo project. it is only react-native project
To make sure that Expo is installed properly: Verify that the
installation was successful by running expo whoami.
If you want an Expo project, run the following command.
expo init AwesomeProject
cd AwesomeProject
npm start # you can also use: expo start
The project you received from Git seems to be a React-native project.
You can try this command.
cd gitproject
npm install
cd ios
pod install
cd ..
npx react-native run-ios or run-android
In the terminal run
expo --version
if installed it will return the version like
5.2.0
else you will get
'expo' is not recognized as an internal or external command,
operable program or batch file.

Running react-native run-ios is success. but not launch simulator

I've been using ReactNative in Windows. Android is perfect and now it has to build on the iPhone and give ipa to clients.
However, even if you run counter-native run-ios after updating the code yesterday, the app will not be launched on the simulator.
I started a new project because I thought there might be a problem with my project, and then I ran a counter-native run-ios, but I failed.
The terminal is output as a successful build, but there is no response to the simulator.
App is not installed.
Somebody please help me.
react-native version is 0.59.9
Images are run on terminals and simulators.
As in latest react-native version 0.60.0 + they have fixed too many problems which are with integration of latest xCode version.
Please do the following to achieve
Upgrade react-native version to 0.60.0 or +
rm -rf node_modules/&& yarn install && react-native link
cd ios and then pod install
Close the bundle and run(Cmd+ r) from xCode
Well, in my case I was in sudo mode. When I turned it back to normal mode, it showed up on the IOS simulator as an app.

Failed to run react native project on IOS Simulator

enter image description hereI'm new to react native, I'm following the official React native's website to init a new project, try to run IOS. But, failed with the error below.
React-Native version 0.59
XCode 10.2
error Failed to build iOS project. We ran "xcodebuild" command but it
exited with error code 65. To debug build logs further, consider
building your app with Xcode.app, by opening HelloWorld.xcodeproj
When I run react-native run-ios --simulator="iPhone 7"
Error as below:
info Command PhaseScriptExecution failed with a nonzero exit code
info
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening HelloWorld.xcodeproj
Starting the simulator : Once you have your React Native project initialized, you can run react-native run-ios inside the newly created project directory. If everything is set up correctly, you should see your new app running in the iOS Simulator shortly.
Specifying a device : You can specify the device the simulator should run with the --simulator flag, followed by the device name as a string. The default is "iPhone X". If you wish to run your app on an iPhone 4s, just run react-native run-ios --simulator="iPhone 4s".
The device names correspond to the list of devices available in Xcode. You can check your available devices by running xcrun simctllist devices from the console.
In my case, I was specifying a simulator, but I had a different simulator open. Targeting the one that was opened, or simply closing it fixed the issue.
try this and see if it works or not.
first go to to ios folder of the project in terminal.
for that you can use terminal in visual studio code.
cd ios then
pod install
go back (to app directory)
cd ..
npm install
npm start
take a new terminal then,
npx react-native run-ios

Resources