The app build fails when using React Native CLI - reactjs

I am very fustrated. The React Native CLI is failing when building the app.
** BUILD FAILED **
The following build commands failed:
CompileC /~/Library/Developer/Xcode/DerivedData/third-eknrlzcnsdfzrlhgyioqgsamgxub/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/ConnectionContextStore.o /~/Projects/reactnativetest/third/ios/Pods/Flipper/xplat/Flipper/ConnectionContextStore.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /~/Library/Developer/Xcode/DerivedData/third-eknrlzcnsdfzrlhgyioqgsamgxub/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperConnectionManagerImpl.o /~/Projects/reactnativetest/third/ios/Pods/Flipper/xplat/Flipper/FlipperConnectionManagerImpl.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /~/Library/Developer/Xcode/DerivedData/third-eknrlzcnsdfzrlhgyioqgsamgxub/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperClient.o /~/Projects/reactnativetest/third/ios/Pods/Flipper/xplat/Flipper/FlipperClient.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /~/Library/Developer/Xcode/DerivedData/third-eknrlzcnsdfzrlhgyioqgsamgxub/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /~s/Projects/reactnativetest/third/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(4 failures)
I did uninstall Xcode and install it fresh but did not make any difference, I got exactly the same error. The errors seem to be related with the Flipper library, but Flipper is installed as a pod in the ios/Pods directory.
Yesterday I tried Expo. The installation of the expo CLI took forever and it got hanging in the iTerm window, so I kill it. But then, when typing “expo whoami”, it gave me the asnwer of “Not logged in”, which means that Expo was installed. I was able to run the app in the ios simulator.
Today, when I tried to run the app again, I got the message that Expo was not installed. Weird, since I used it yesterday. I did the Expo cli installation again today and it did the same than yesterday. It has been more than 3 hours hanging in the terminal. But when I type “expo whoami”, I get the correct answer and I am able to run the app.
Also, today I did install the latest version of Android Studio 4.1.2 (I had version 1.3). After installation, Android Studio opens a window and then quits. I researched and it seems like Android Studio does not work on Mac version greater than 10.14 (Mac OS Mojave).
Why I am having so many problems just to run the app?. Anybody else having these problems?. Any solutions?.

If you are not using flipper just comment it out on the Podfile, that fixed the issue for me,
How to do it,
open podfile and make sure all this is commented,
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# end
update pods
pod update
That will fix it,
If you need flipper you'll have to specify use_flipper!({ 'Flipper-Folly' => '2.3.0' }) version and run pod install

Related

my React app does not update during runtime, when I make changes and save. BUT works on my Macbook but not on my Windows PC

On Windows device:
When I run react-scripts start
In my terminal it says that my "webpack compiled successfully".
When I apply new changes to my code and save, the app does not update on runtime with the new changes.
On Windows Device
I have tried this in both powershell and a wsl (ubuntu 18.04) terminal with node v16.19.1
When I run react-scripts start my react-app is compiled successfully
But when I implement changes it does not update directly.
When I terminate the terminal and rerun the script
I can see my change, but again does not update on runtime again.
(No Result) I have removed my node_modules and redid all my dependencies.
(No Result) I have started with ubuntu 22.02 and downgraded to 18.04
(No Result) I have downgraded node 18 to 16 too
project is written in .jsx
On my Macbook and expected result
When I run react-scripts start my react-app is compiled successfully
and when I make changes and save, it does update on runtime.
Question
I would like to know why my react-app does not work on runtime on my Windows device and a possible solution.

extJs 7.0.0 Community Edition - install docs not working

I'm on mac.
Following the guide here: https://docs.sencha.com/extjs/7.0.0-CE/guides/getting_started/mobile_desktop_application/getting_started_with_npm.html
I signed up for to the community edition, received the mail, created my sencha.myget.org account, and did the following commands successfully in a terminal:
step 1: login to npm repo
npm login --registry=https://sencha.myget.org/F/community/npm/ --scope=#sencha
step 2: install app generator cli
npm install -g #sencha/ext-gen
step 3: generate the app
ext-gen app -a
Now step 4 (run the new application) is where I have a problem:
cd my-app
npm start
Gives me this error:
If I open the log I can see the exception message:
/Users//Desktop/test/extjs/my-app/node_modules/#sencha/cmd/dist/plugin.xml:378: The following error occurred while executing this line:
/Users/me/Desktop/test/extjs/my-app/build.xml:15: Unable to create javax script engine for javascript
What am I doing wrong?
So this is how I did it on mac 10.14.
Ok, so reading about javax, apparently it was used in java se8 (https://docs.oracle.com/javase/8/docs/api/javax/script/ScriptEngine.html).
So, I downloaded it using this website: https://adoptopenjdk.net/,
and more precisely this page: https://adoptium.net/?variant=openjdk8.
Once downloaded, I had multiple versions of java installed on my computer and so I had to switch to that one.
So I learned how to switch to any java versions.
First to display the existing versions, type this in the terminal:
/usr/libexec/java_home -V
Then to change version:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
(notice that for the version number you just type the first two digits, not the whole version number )
To check that it worked:
java -version
Once java 1.8 (apparently that's the version name for jdk8) was running, the npm start command worked without errors.
You need to downgrade Java to any version less than 15, because the Nashorn JavaScript Engine had been removed, which it depends upon. Downgrading Java as far as version 8 probably isn't the optimum (in particular, when also using it for Java development).

Unable to run the first time react-native app for android on mac

I'm trying to run the react-native application on the macbook for android version.So I have followed all the step for setting up the environment on the machine from here :
https://facebook.github.io/react-native/docs/getting-started.html
And I have successfully install Android Studio,Android SDK, JDK, Node, NPM, Watchman, Homebrew
javac -version : 9
node -v : v8.9.1
npm -v: 5.5.1
watchman version: 4.9.0
When I tried to run the application with the command
react-native run-android
I got this error :
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/Users/aman/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.925 secs
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/android-setup.html
According to this GitHub issue, this issue has to do with JDK version. Make sure you're using v8, not v9, then the error should not occur.
Yes, according to #Sam Hanley it's an issue with the java version update. So, with worrying about the version update/downgrade, we can pass on with this issue by the following process;
First, update the distributionUrl in gradle-wrapper.properties
ie: located in this path;
PROJECT_PATH/android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
Set $JAVA_HOME environment variable using the installed android studio app path (Android studio should be installed)
export JAVA_HOME="/Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home"
(PS: solution for macOS )
Hope this help!
I was able to get past this particular problem by doing the following:
Edit path_to_your_project/android/gradlew
Change DEFAULT_JVM_OPTS="" to DEFAULT_JVM_OPTS="--add-modules java.se.ee"

Expo XDE for Windows hangs when i create a new project as react-native

11:19:13 PM
Starting React Native packager...
11:19:21 PM
Scanning 535 folders for symlinks in C:\data\TodoList\tasklist\node_modules (16ms)
11:19:21 PM
Loading dependency graph.
11:19:21 PM
Running packager on port 19001.
11:19:21 PM
11:19:38 PM
Dependency graph loaded.
when i create new project i get the aforesaid on console and then it hangs ? is there any prerequisits for this to run why i may have not installed ?
i assumed its the virus guard because kaspersky prompted a warning, but it still hangs even after the disabled it [the virus guard].
I solved this problem by this all. following are all required and after installing them expo-xde started.
1)Disable secure boot in BIOS
2)Enable Virtualization in BIOS.
3)Reinstalled Expo-XDE
4)Installed Python and JDK which is required according to documentation
5)Installed react-native cli using npm.
Restart your machine now.
6)Even if this doesn't work then install Genymotion as Android virtual device API-23 Marshmello, which comes with by-default Expo app and you can run npm run android from command line and enter url in Expo app in Genymotion.
complete steps of Genymotion(step 6), I followed from here.

react-native run-android hangs

I am starting a fresh app with react-native, and following the getting started tutorial here. I have installed Android Studio, the sdk and avd files, and the react-native init seems to work ok...
react-native init myapp
>>
Installing React...
Installing Jest...
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
Then I try and run the app
react-native run-android
And it just hangs there (even left it overnight).
If I do an strace
...lots of stuff then
read(12, "HTTP/1.0 200 OK\r\nServer: Motion/3.2.12+git20140228\r\nConnection: close\r\nMax-Age: 0\r\nExpires: 0\r\nCache-Control: no-cache, private\r\nPragma: no-cache\r\nContent-Type: multipart/x-mixed-replace; boundary=--BoundaryString\r\n\r\n", 65536) = 217
epoll_wait(5, [{EPOLLIN, {u32=12, u64=12}}], 1024, -1) = 1
read(12, "--BoundaryString\r\nContent-type: image/jpeg\r\nContent-Length: 4235\r\n\r\n\377\330\377\340\0\20JFIF\0\1\1\0\0\1\0\1\0\0\377\341\0\224Exif
And then keeps cycling with the line...
read(12, "--BoundaryString\r\nContent-type: image/jpeg\r\nContent-Length: 4235\r\n\r\n\377\330\377\340\0\20JFIF.....
I have tried things like reinstalling react-native, the sdks etc, but error persists.
I have also seen a similar error linked to watchman with react-native init, but I don't think this would apply, as I don't currently have that installed (have tried with it installed previously).
I am using Linux Mint 18
4.4.0-51-generic #72-Ubuntu SMP Thu Nov 24 18:29:54 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Ok, it was a camera application using port 8081 that was causing the issue.
If I kill that process it works. I checked the ports in use by
netstat -tulpn
look for port 8081 in there, then
kill -9 <pid>
Assuming it's something you are happy not to have running, and change its config.
Would be handy if react-native checks for a port in use and reports it if it is, to save others having the same issue.
If you're on Windows, you can try:
Ctrl + Alt + Delete to bring up the Task Manager
Select the "Node.js: Server-side Javascript" process
Click the "End Task" button
Then try the react-native run-android command again.
I hope it helps.
ran from Command Prompt as Administrator (that got the react-native start to run)
Then in the other command prompt when run-android I got after an extremely long wait: Could not determine java version from 10.
I upgraded gradlew in the [project]/gradle/wrapper/gradle-wrapper.properties to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-src.zip
Then waited a long time for it to finish, seemingly doing nothing.
Got a filenullpointer exception in findLauncherJar...
Read further and changed to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip
Then it hung with a message:
gradle refresh failed could not find com.android.tools buildg
Found SO 38702032 which suggested changes to the file Android/build.gradle and corrected the gradle version to 4.3.0
Got another error and went to http://jcenter.bintray.com/com/android/tools/build/gradle/ to see what versions existed. Found that the last was 2.3.3
Put it back to what it was and added mavenCentral
Also checked that I have the paths (C:\Users\MyUsername\AppData\Local\Android\Sdk\platform-tools;C:\Users\MyUsername\AppData\Local\Android\Sdk\tools)
and the three environment variables (c:\program files\java\sdk-10) and that I have the two ANDROID_HOME and ANDROID_SDK_HOME (c:\users\MyUsername\AppData\Local\Android\Sdk) ...
rebooting and works.

Resources