React Native Expo Timout Error - reactjs

I'm currently trying to learn react native. I created a project using create-react-native-app. After the project is created, I started npm start on the folder which shows the QR code. I've installed the expo app on my android phone and scanned the code but I'm getting a Uncaught Error: Timed out, no manifest in cache on my expo app and there is no stack trace given.
I've made it work a while ago but somehow its currently not working.
Im using windows 10.
npm 5.6
yarn 1.5.1

What I've done to fix it using Ubuntu was (I created my app using create-react-native-app):
open terminal
execute ifconfig
find network interface (wlp4s0, in my case)
execute export REACT_NATIVE_PACKAGER_HOSTNAME="IP_FOUND_BEFORE"
yarn start
SUCCESS! Finished building JavaScript bundle in 10069ms

Expo only supports the most recent 6 versions, this is because we have to have all the native code for each version on the client and that gets big fast 🙃💣. As of writing this v26 is almost out, that version of the expo client will not support v19 projects. Please make sure that your app is up-to-date by going to the app.json (or exp.json depending on how old your project is 😅) and checking the version number.
Outside of that, I would also recommend you start your project by calling exp start in the root folder of your project 💙

The problem that causes this is having multiple network connections. In my case, I have a virtual network connection which is used by the packager instead of the wifi connection. So basically what's happening is that my phone and my computer uses different connections. I've found a solution here: https://github.com/react-community/create-react-native-app/issues/598

Related

Fresh ReactJS project stuck at starting the development server

I am running a fresh react project with no single line of code written by me.
All I did was:
npx create-react-app my-app
npm install
npm start
The browser window opens and within my console window I see "Starting the development server". It is stuck there, have been keeping it up for over an hour with no progress.
I looked at different SO threads as well as many suggestions on other platforms. From limiting the RAM available to using another port, closing all browser windows, rebooting my machine - nothing helped.
Do you have any suggestions for troubleshooting?
Running on macOS 13.1 on M1 Pro.
It was the directory I started the project in. Using spaces and several special characters seems to break react as well es next.js which I tried next.

Fresh Nextjs app generates runtime errors

I'm trying to do a fresh install of nextjs on Windows (see command line screenshot) using gitbash and latest nodejs lts version (16.14.2). When running npm run dev everything seems to be in order.
However, after browsing to http://localhost:3000, I receive this:
I looked at Fresh NextJS App throwing errors before any changes but the version in that issue is next 11.1.1 whereas current is 12.1.4. At this point I'm pretty much stuck. =\
Turns out it was an issue with Chrome extensions. I disabled all of them and no longer received the error. One by one I re-enabled all of them but never found the source. =\

React native EXPO installation (npm start)

I created my app in react native using Expo but when i run the npm start command its showing me this:
running metro bundler on port 8081
and then
loading dependency graph, done
and never end. what to do?
Here is the complete console output.
First of all if you have a bundler like the one that you have used then it would suggest that you have used react-native init to create you application, instead of expo.
Expo bunders look like this:
If you have created a react-native init and as it suggests in your screenshot that you are building the app on a Windows machine, that means you will be developing on Android.
The instructions for using Android and running react-native are quite long and complicated, they can be found here. For the sake of brevity I am not going to repeat them here asyou can just follow this link. Make sure to choose Building Projects with Native Code -> Development OS: Windows -> Target OS: Android to find the instructions that are pertinent to your situation.
https://facebook.github.io/react-native/docs/getting-started.html
If you are planning on developing on an emulator then you will need to make sure that you have one installed (the link above has all the info that you need). Also you need to make sure that you launch your emulator before running react-native run-android if you do that then it should load on to the emulator and you should be able to see what you are developing on.
If you want to run on your own Android device then you should follow the instructions on this page https://facebook.github.io/react-native/docs/running-on-device (again choosing the options for your situation).
Expo
If this feels like too much effort, you can always try Expo. It doesn't require you to be able to deal with native code. And depending on your use case can be a better option than creating a project with react-native init, plus you can always eject from the expo project and turn it in to a full fledged react-native app.
You install the expo-cli with
npm install -g expo-cli
Then download the expo app from the App Store or the Google Play Store (depending on the mobile that you are using).
Then you can use
expo init
to create your application
Check out the expo documentation for more information https://docs.expo.io/versions/v32.0.0/workflow/up-and-running
Well, Nice question, First of all, I totally understand what's exactly your problem is, let me give you a solution in a very appropriate way.
Basically, there is two way to install and setup React Native Project on your mac and windows machines
1st React Native (native) Method: (That's basically you're using right know
Note: If you're using Apple product - Like MacBook then you can do IOS and Android both platform by using this method, if you're using Windows or Linux you can only do this part for Android platforms
In this method, we have to follow these simple steps
Download Nodejs from Offical website link here
Installing the React Native Cli
npm install -g react-native-cli
If you get an error like Cannot find module 'npmlog', try installing npm directly: curl -0 -L https://npmjs.org/install.sh | sudo sh.
(Only for mac)
Install the Xcode from Appstore (Only for Mac user/macos users)
otherwise
download and install the Android Studio (Stable version) from the official website of Android studio
Setup Xcode (Simulator) or Setup Android Studio for Android devices use (emulator)
by learn and guide from this link here
Note: Basically in your scenario, I'm pretty sure you didn't set up your emulator for android and simulator for IOS that's why you didn't see anything after
2nd React Native with Expo Method: that's you're not using a loading dependency graph
Use
For Android
react-native run-android
For IOS
react-native run-ios
2nd React Native without Expo (that's not your case):
In this method, we have to follow these simple steps
Download Nodejs from Offical website link here
installing expo cli
npm install -g expo-cli
expo init yourprojectname
cd yourprojectname
npm start
Note: Simulators and emulators way same for both

React Electron App built with asar on gitlab runner creates JavaScript errors

i will just start my question a little bit structured:
background information
I am developing a React App with Electron on my Mac.
The customer uses this app on Windows 7 and 10.
The app is packaged with asar on a gitlab runner within a docker
the dockerfile for the runner is from electronuserland/builder:base
What works?
If I start the App locally I run the npm build script and start electron -> The app works fine!
If I package the App locally (on my Mac) for Windows and copy the .exe to my VM: -> The app works fine!
What does not work?
If my pipeline get triggered by my commit the gitlab runner starts to run the buildscript and the package script (The same ones I run locally for packaging and running my app) The build is "successfully" completed and the artifacts are stored on gitlab.
Then I download the .exe from the gitlab artifacts on my Windows VM and install the software. This absolutely works fine. The app can start up and some functions are pretty good working.
But there is a problem with a package (or maybe some more, i do not know yet) It is the react-bootstrap-daterangepicker. It gives me an JS error with $this.$picker.daterangepicker is not a function
I googled a lot and found existing problems with the package, but I do not understand why it is working when i package the app locally and not with the runner.
I removed my node-modules completey on my local machine and reinstalled them, and it is still working fine.
Do you have any idea?
Where could be a difference between my local environment and the runner environment that can cause this kind of problem?
I am pretty stuck in this problem, and you would be my hero if you can help me to fix this!
Have a nice day!
electron-builder recommends using electronuserland/builder:wine to build Windows targets. I'm not sure if this would fix the problem, but could you try using this image instead?
electronuserland/builder:wine — Wine, NodeJS 10 and required system dependencies. Based on builder:10. Use this image if you need to build Windows targets.
For more information: https://www.electron.build/multi-platform-build#provided-docker-images

can not install app on react native

I am trying to install an app with react native cli but get the
ERROR: JAVA_HOME is not set and no 'java' command could be found in
your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation. 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
error...
And frankly this is sooo ofrustrating... Never had an issue with ionic or cordova nor android studio but infortunally, I need some native functions for my app...
Here is a background, at first the app was installing, I even was able to run hot reload on it then out of nowhere, without any change on the computer, I get this message whenever I try :react-native run-android".... I followed exactly what's on facebook github page but got this error... So i tried running a simple app on android studio and it worked...
Can someone have solution and also why this is happening out of nowhere?
Oh, I forgot right before I got this error, for some reason, I had to reinstall npm because nodeJs was not recognizing the npm command anymore
Ps : I even uninstall then reinstall android studio, uninstalled react-native-cli and reinstalling it, uninstalled react-native-create-project, reinstalled npm.
Check like this maybe this is the issue I guess:
1.Open the App that u have created using create-react-native-app or react-native init appName in android studio
It will be something like: appName>android>local properties(SDK location)
2.If u use windows pc/laptop then go to my computer right click for properties>advanced system settings click on that and find the environmental variables
and check if they are matching
Well, I got tired of it since none of the solutions on the web worked, I just wiped out my computer, reinstalled windows, got rid of all the non needed programs, reinstalled android SDK, java, react and... Still got this error... So I set JAVA_HOME (thanks youtube) and now it is working.

Resources