Error in RNScreens when building in xCode on Mac M2 - react-native

I have a project that has been successfully run on previous mac machines but since upgrading to a Mac M2 it will no longer build or run in an xCode simulator.
NPM install and the pod install commands run successfully. The problem is when trying to build the project we get the following error
'React/RCTEventDispatcherProtocol.h' file not found on line #import <React/RCTEventDispatcherProtocol.h> of RNSCreens (react-native-screens) which is required for react-navigation.
Using:
Mac OS Monterey
Node v14.18.1
NPM 6.14.15
React 16.13.1
React Native 0.63.0

Related

Cocoapods error when Initializing react-native app on Mac mini (Apple M1, 2020) running Monterey

I'm on a Mac mini with Monterey OS trying to init a react-native app.
npx react-native init AwesomeProject
gives me:
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./AwesomeProject/ios && pod install".
CocoaPods documentation: https://cocoapods.org/
when I try
cd ./AwesomeProject/ios && pod install
I get:
664 /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/ffi.rb
665 /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: https://www.ruby-lang.org/bugreport.html
[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.
zsh: abort pod install
Is anyone else encountering the same problem?
EDIT:
Uninstalled and re-installed Ruby and Cocoapods.
This was a helpful post
and used:
arch -x86_64 pod install
Using that processor does bring some issues with installing pods. Please try arch -x86_64 pod install and see what it brings.
Link to some older post:
React Native ios builds failing suddenly

How to run an old version of react native

Just a quick question, how to run an existing older version of react native project. Lets say version 0.59.10 , without upgrading it. what would be the command line commands. Thanks
You should navigate to project directory (if you aren't yet)
cd PATH_TO_PROJECT_DIRECTORY
run the following command to install the dependencies
npm install
then if the react-native version is 0.59.10 and lowers you should also run the command below to link the dependencies to your native android and ios project.
react-native link
and then run one the following commands based on your device
for android
react-native run-android
for ios
react-native run-ios

"could not connect to development server" error running React Native tutorial with Expo, suspecting Watchman

New to react native and mobile dev, running into this problem:
I am running the React Native hello world from the Facebook Website using Expo CLI as the build tool. What I did was to install Expo, run expo init test, install cocoapods, and cd into the test directory and run expo start.
When I open the app on iOS simulator or my iPhone, I get "Could not connect to development server" after about 3-5 minutes in white screen (see screenshot).
In the Expo logs. It is notable that upon every startup I get the following error logs:
2019-08-25T21:49:21,474: [cli] Failed to open /Users/nsadeh/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Not a directory
ERROR
21:49
Watchman: watchman --no-pretty get-sockname returned with exit code=null, signal=SIGABRT, stderr= 2019-08-25T21:49:21,474: [cli] Failed to open /Users/nsadeh/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Not a directory
I have already tried un- and reinstalling Watchman as well as Expo. Not sure what else to do.
To reproduce:
macOS Mojave 10.14.6
node v10.16.3
expo 3.0.10
Watchman 4.9.0
react-native 0.59.10
Run expo init and from the top directory expo start.
Solution: turns out that postgreSQL left an unrelated LaunchAgents.plist file in my Library that was confusing Watchman. Renaming it resolved the issue.

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

An error occurred during upgrade in react native

I am working on react native app, started the app using CRNA command to create the project then exp detach to detach. The problem I am having is this: when I started the app I was on windows, so it only created android folder while detaching, now that I want the app to build for iOS I kinda need to generate the iOS folder, to do this I am running react-native-git-upgrade so that it would generate iOS folder, but it throws an error as follow:
An error occurred during upgrade: git-upgrade ERR! Error:
react-native version in "package.json"
(https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz)
doesn't match the installed version in "node_modules" (0.54.2).
Is there any way that I can generate iOS folder without having to upgrade the app? I am so confused in this case and it seems that its quite benefit starting an app from an Mac OS system in this case, so u have both android and iOS folders generated.
Also tried to delete node_modules folder and tried npm install and it seems it added some packages but then again I get same problem when running react-native-git-upgrade
Note: I have node v10.0 installed on Mac
Anyone have any idea on this?
I successfully upgrade RN project using react-native upgrade instead of react-native-git-upgrade, here's the step:
You will be need to input project name in package.json on project root, just add this value "name": "<YOUR-APP-NAME>".
then run react-native upgrade, if you are prompted to downgrade RN package, to downgrade usenpm install react-native#x.x.x, for example: npm install react-native#0.43.4. check installed version using react-native -V.
Now run react-native upgrade, you will be asked to replace some files, input y to confirm.
After the upgrade done, revert to latest version of RN package using npm install react-native#x.x.x.