React-native no bundle URL present on getting started project - react-native

I am trying to run react-native on an Iphone simulator via "react-native run-ios" following the getting started guide (https://facebook.github.io/react-native/docs/getting-started.html)
on react-native's official website, everything seems fine and the new terminal pops up saying "loading dependency graph, done.". The app starts taking a long time to load then it says "No bundle URL present".
This is not unique for this getting started project. I have tried to clone other react native projects having the same result
What can cause this to fail on both the getting started projects as well as other projects?

I solved this issue by deleting the build:
1. YOUR_PROJECT/ios/build/,
then I ran the project again by changing the port:
2. react-native run-ios --port 8080

Related

Why does my Expo app run in Expo Go but not as a development build?

I've created a development build of an Expo app using EAS. Previously I would open the app in Expo Go by running npx expo start and scanning the Metro Bundler QR code.
Now, when I try to do the same thing, Expo Go asks whether I want to open the project in Expo Go or as a "Development Build". It works fine in Expo Go, but crashes immediately when I attempt to open the dev build. The error reads:
null is not an object (evaluating '_ReanimatedModule.default.createNode')
This error is suspiciously similar to one that I encountered earlier in development, which I resolved by downgrading to React Native version 0.69.6. I'm also encountering a second error that says "'main' has not been registered", but I suspect this is downstream of the first error.
I have the same issue when I try to run the app with npx expo start --dev-client.
Any ideas why I might be having this problem?
It sounds like you may have run expo prebuild (https://docs.expo.dev/workflow/prebuild/) which removes "main": "node_modules/expo/AppEntry.js", from app.json. Try to create a new expo app and look at it's app.json file.
When you run expo prebuild it changes a few things with your project (see "side effects" in the prebuild docs).
I'm actually working through some issues with that right now too. I thought I had to run prebuild but turns out I didn't have to. Ever since I ran it my app will not load via the dev-client way. I can however switch back to npx expo start (NOT npx expo start --dev-client, see the scripts section of app.json as that is also changed when prebuild is run).
Let me know if you are able to get your app to load after re-adding the main stuff to app.json.
Ps, are you by chance using react-native-google-mobile-ads?

React native (Expo) project shows "cant find variable : require"

I am an intermediate react developer.
I was running my react native app peacefully without any problems untill one morning, i did not change anything in my codebase but when i tried to run the app through expo client, it started showing the error in the screenshot.
I have checked and checked this platform, and not a single solution.
I am currently using expo sdk 43 (managed workflow) please help...this is my first time posting here.
This is the error below;
Can't find variable: require
http://127.0.0.1:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:5:24.globalcode#http://127.0.0.1:19000/node_modules /expo/AppEntry.bundle?platform=android&dev=true& hot=false&minify=false:720:3.
Click here for the screenshot of the error
I got it fixed.
See what i did,
I created a fresh expo project using "expo init"
Then copied all my files into the new project "except node_modules and .expo folders".
Then i ran "npm install"
Viola!!! Everything works fine now
Note: i tried removing "node_modules" before over and over again and it dint work.
The only thing that worked was starting a new project and following the above steps.

My Node Js starts and exit automatically when I compile React-native app

I have an issue that started to happen few days ago, when I create new project in react native and then trying to start it with "react-native run-android" it starts to compile then shows build successfull but my Node.js not opening it should be started but somehow it is not, how should I fix it ?
I dont see any errors as I mentioned above it shows build successful but node js server wont start

React Native white blank screen issue

Always getting white blank screen when running the app on the physical device in android case. Using react-native-navigation can't able to detect the bug please help!
I have created a fresh react-native project and integrated the react-native-navigation library into it and when I am running the app in my physical device by running the command yarn run android it runs but shows blank white screen in android. Once it runs successfully but now it won't.
run react-native start in a separate terminal and then run react-native run-android.
i recently faced two kind of white screen problem
1.always showing white screen (due to bundling..)
solutions is
react-native start
and then
react-native run-android
2.it shows white screen some particular seconds or suddenly always shows white screen in properly working app
due to app cache or traffic
solutions is
Androidmanifest.xml
android:usesCleartextTraffic="true"
If Debug JS Remotely is on then also we see the blank screen. I have recently come across this issue. So check if you are already running Debug JS Remotely. If you are running it already then just stop remote debugging. And it will work.
Running ./gradlew clean on android folder and then uninstalling the app from the phone worked for me.
In my case, was using my Phone to test and develop, and suddenly white screen issue appeared.
The app was not loading at all, no error, no code update only white screen comes up after npx react-native run-android.
My solution was to clear the phone cache as it was loading from cache.
I restarted my phone then cleared all cache and then it worked for me.
Use "react-native init" command for the creating the project as it only build react-native not expo and the other node modules for you and then build for the particular platforms for eg. in my case "react-native run-android" and it works.
There is step-by-step what I do to run app on physical android device:
Open 'android' folder from app folder in IntelliJ
Run in IntelliJ, target: USB device
After .apk finish installing, shift-right click in app folder, run PowerShell, type 'react-native run-android'
After it finish, open app on physical device, shake it to open developer menu, and hit 'Reload'
you can also hold menu button on your device to open developer menu(while app is running)
I also faced same issue in the emulator. So the way I solved it is by going into Android settings - Apps - select the app, and force stop it. Then I tried opening the app again and it worked.
Before I did this, I removed the 'build' folder under /android/app/ and re-ran. Did not work.
One thing that often resolves this problem for me is re-installing your node_modules folder and cleaning your gradle build. You can do this manually, however, if you've run into this problem once or many times, consider running a shell script to automate this process.
Create a file called clean.sh and paste this inside:
echo "Removing node modules from $1 then reinstalling..."
cd $1
rm -rf node_modules
yarn install
echo "Cleaning gradle project..."
cd android
./gradlew clean
cd ..
If using npm, change "yarn" above to "npm".
Put the file above in the parent directory of your project (if your project is located at C:\Users\your.name\projects\project1 put the clean.sh file at C:\Users\your.name\projects\).
To run the script, inside of Git Bash or your Unix terminal run this (make sure to change the name of the directory below to the parent directory of your project):
cd C:/Users/your.name/projects
./clean.sh <project-name>
Now when restarting your app, try also reset the packager's cache.
With yarn:
yarn start --reset-cache
yarn android
With npm:
npx react-native start --reset-cache
npx react-native run-android
In my case I had a metro terminal running from my previous project. closing it and running the new project again solved the issue.
Use react-native-splash-screen. I try many ways to fix this issue but it's not working and i think this is the best way.
For me my wifi was disconnected on my test device.
I had to make sure both my computer running the react packager/server and my device were connected to the same wifi network.
I have recently faced this kind of white screen problem
1.always showing white screen after Release
"npx react-native start"
and then
"npx react-native run-android"
2.it shows white screen some particular seconds or suddenly always shows the white screen in a properly working app
due to app cache or traffic and android Newer version also in some case when you are using API with HTTP instead of HTTPS
The reason is that newer android versions are more secure and they try to restrict HTTP request
solutions are
add this line in path project\android\app\src\main\androidmanifest.xml:
android:usesCleartextTraffic="true"
In my case:
1: I tried npx react-native start to run metro.
2: Then write npx react-native run-android in cmd, there was still a white blank screen.
3: I still faced the same issues, then I always comment on every single component, and automatically, I resolve the error. This is the best technique I ever used.
If you are trying to get it working on a Android device, make sure you have first tried to clear cache for the App, doesn't matter if reinstalled.
Try the other answers only after you have cleared cache.
It can not find its navigation's route. You should check the navigation.

React-Native packager stuck on `Requesting bundle`

I'm trying to run a boilerplate react-native app and the packager seems to stall out right at the beginning when the javascript bundle is requested. Eventually the iOS simulator gives up and throws Could not connect to development server.
Here is the terminal output:
[01/17/2017, 10:48:00] <START> Initializing Packager
[01/17/2017, 10:48:00] HMR Server listening on /hot
React packager ready.
[01/17/2017, 10:48:47] <START> Requesting bundle
bundle_url: /index.ios.bundle?platform=ios&dev=true&minify=false
I haven't been in react-native for a few months but I used to be able to specify whether the app should load from a bundle or just load the js directly. I would load directly when the xCode project was in debug mode or from a bundle when in release mode.
Again this is just straight boilderplate - no external packages or anything. Just using react-native init TestProj and then cd TestProj/ && react-native run-ios
I'm using the last version of react-native 0.40.0 and the expected react dependency of react#~15.4.0-rc.4.
Thanks for any help on this.
I'm not sure what the issue was but it was fixed after I restarted my computer. I also had issues getting the code to refresh once the app was loaded. That was fixed by uninstalling nodemon globally.