Can't run my React Native project - xcode

for some reason I can't run my project with npm run ios. I receive a Entry, ":CFBundleIdentifier", Does Not Exist error.
The funny part is that I can build, and run my project with xcode (debug).
Anyone got any idea why npm run ios throw an error, BUT xcode run smoothly?

Related

Xcode 13 Debug-iphonesimulator/YogaKit/YogaKit.modulemap not found for a brand new project just initialized

A brand new React Native 0.66 app was created with command below:
npx react-native init myapp
The app was launched successfully with npx react-native run-ios. In Xcode 13, the myapp.xcodeproj is opened to test if the build will pass. To my surprise, build throws the error below:
fatal error: module map file '/Users/macair/Library/Developer/Xcode/DerivedData/xyz_app6-gpxsmunajzbqoualaavtsfpnerep/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found
What is wrong here? I haven't put any code into the app and it is all React Native generated code. Xcode becomes beast by itself even though the React Native app itself runs fine. That's why the app has to be rebuilt.
This seems to be a common problem. The solution works here is just open the myapp.xcworkspace in Xcode instead of myapp.xcodeproj. The build upon workspace went through without any error.

React native IOS build issue

I installed Xcode from AppStore and started the project with react-native init IOS_project command. I had an error after running npm run ios and I opened .../IOS_project/ios/IOS_project.xcodeproj file with Xcode and started the build. Build was failed with the error
fatal error: module map file /Users/artemgorovoi/Library/Developer/Xcode/DerivedData/IOS_project-distoubdwfsutrcrzcjxmzmcwzfx/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap not found
https://i.stack.imgur.com/CWx5U.jpg
https://tinyjpg.com/web/output/rt2x4mgj3tgk8607dy3q0ad6utw2ep1m/94D33C31-0A82-406D-B07F-299E0F621023.png
this happens because in order to run your React Native project through Xcode you must open the .xcworkspace file, in your case IOS_project.xcworkspace, if you only open the .xcodeproj file Xcode won't be able to locate your Pods

Module moment not found after installing react-native-community/netinfo

I am facing the issue "react-native-community/netinfo" while running my react-native project.
I have reinstall this module but get the same error again.
Before I run my application, I run Yarn and pod install, that run successfully, but after that it is showing this error that I have shown in the in this image. How can I resolve this error to run my project?
I am attaching the error and followed the given steps but it did not work for me.
Unhandled JS Exception: #react-native-community/netinfo: NativeModule.RNCNetInfo is null. To fix this issue try these steps:
Run react-native link #react-native-community/netinfo in the project root.
Rebuild and re-run the app.
If you are using CocoaPods on iOS, run pod install in the ios directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
Check that the library was linked correctly when you used the link command by running through the manual installation instructions in the README.
If you are getting this error while unit testing you need to mock the native module. Follow the guide in the README

I can run the IOS emulator but project is not present

Unfortunately, I've deleted my react native project with Xcode may it be the .xcworkspace file or .xcodeproj. file
So in order to get my project back with .xcodeproj, I had to rename my project eject and update react native. Having said that I am able to load the emulator but the project is still not present in the emulator. How do I reintegrate it back?
Here is the error that is seen on terminal:
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 Project.xcodeproj

How to eject expo project to native code

I eject project from expo with command npm run eject. It generates 2 folders ios and android. I tried to run the project by xcode but it still display this error. Maybe I'm not clear how to run project after eject, can you help me run it.
I run some statements to install pod, but cannot work https://github.com/CocoaPods/CocoaPods/issues/2303
So with ejecting, you should have been presented with two options:
? How would you like to eject from create-react-native-app? (Use arrow keys)
❯ React Native: I'd like a regular React Native project.
ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK.
Cancel: I'll continue with my current project structure.
If you chose the first (React Native), then there should have been no issues with opening up your Xcode project and running the app (there would also be no pods to install). Since your error and comment indicates otherwise, I can presume that you chose option 2: Expokit.
For that, you should have been prompted with something about making an Expo account or using an existing one:
? How would you like to eject from create-react-native-app?
React Native: I'd like a regular React Native project.
❯ ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK.
Cancel: I'll continue with my current project structure.
An Expo account is required to proceed.
? It appears you're already logged in to Expo as ...
After that, you'll need to follow the steps in Developing With ExpoKit. Specifically to get iOS running, you need follow all of the steps in this section after running npm run eject.
If you've done all of that, then it should work fine when running in conjunction with Expo XDE or exp. I've just tested both right now and it works without error. Double check your steps to make sure you didn't miss something. Otherwise, please edit your question with more details on exactly what commands you ran, what other dependencies you have, etc. as I'm unable to reproduce the error you have.
If you want to download new project without expo then try run:
react-native init ProjectNameHere
or , If you want to convert your own project without expo then try :
1. rm -rf node_modules
2. remove expo dependencies from package.json
3. npm install
4. react-native upgrade
(Note:This following step will create new ios and android folder and you have to redo the dependencies. I was struggling with the same issue so I posted my solution)

Resources