Getting an error running the simple initialised app in React Native - android

I've created the simple intitialised app via:
react-native init myApp
It creates it fine. And when I run it with:
react-native run-android
I get the following error:
Error: Unable to resolve module `./Libraries/YellowBox/YellowBox` from `node_modules\react-native\index.js`:
None of these files exist:
* node_modules\react-native\Libraries\YellowBox\YellowBox(.native|.android.js|.native.js|.js|.and....(continues)
The incredibly frustrating thing about this is that I've successfully run the initialised app (on previous initialisations) multiple times in the last few days. So I don't know why it won't run today (tried three initialisations today). I haven't changed the code one character from the intitialisation. I've tried restarting my computer, deleting my virtual android device (via Android Studio) and creating a new one. Still the same error keeps coming up. I've tried running it via my physical Android device, same error. I've tried deleting the node-modules from the project and reinstalling them (npm install). Same error. Any ideas?

I managed to solve it using this command:
react-native start --reset-cache
After start of the Metro run the app:
react-native run-android
In my case it happened after updating a package.

Ran into this same issue, found it to be a caching issue with metro.
YellowBox was moved to YellowBoxDeprecated.
I was able to fix this issue by doing the following:
delete node_modules and package-lock.json
clear metro-cache folder.(for windows default location is %appdata%\Local\Temp\metro-cache)
clear gradle cache (cd android & .\gradlew clean)
npm install the packages

Related

React Native Metro infinite 'reload'

Environment
"react-native": "0.63.4"
node --version: v15.8.0
When I try to run application on two phones (Android via USB and iOS emulator) by running following command:
npx react-native run-android && npx react-native run-ios
my application launches correctly but on running it shows me infinite reloading. (what I mean by infinite is that message 'Refreshing' shows up then disappears and so on in infinite loop.
And after a dozen of reloading it ends up with an error.
Here are the errors.
Thank you in advance!
I had the same issue and managed to solve it by placing the project folder inside a "tmp" called folder.

Could not connect to development server - react native error

I had a react native project that is working fine and I switched to another project which is also a react native project. When I came back to the development of the first project I ran the following commands. I use a physical device to debug.
cd ./projectfolder
react-native start --reset-cache
react-native run-android in another terminal
Now the following problems are there, I would like to know what are the causes.
react-native start starts the Metro Bundler but it does not show the
loading progress of the files after react-native run-android
finishes. (Does not serve files)
Still the application starts without any red screen. (How does this
happen if the Metro Bundler has no progress shown?)
Since the application starts I can shake the running device and try
to enable the hot loading but it gives a error on the red screen.
(Sorry for the bad quality, I got this from internet. The same message is there on my physical device.)
I have tried the following methods.
Clear the npm cache using npm cache clean --force.
Make sure that the laptop and the mobile are on the same wifi.
Add android:usesCleartextTraffic="true" to the manifest since there are Android 9 related changes as per most github answers.
Uninstall the application and trying to run again.
Restarting everything.
Ran the bundle command and try but it will not help start the debugger.
Can I have any help on this? Thanks in advance.

Could not run react-native app android. Getting syntax error in the metro bundler which are related to react-native-wheel-picker

I have been trying to run a react native app on my windows laptop. Whenever I use npx react-native run-android I am getting some syntax error as shown below which suggests some error in react-native-wheel-picker package. I tried to debug my going through the library documentation, but everything looks fine. Can anyone help me through this?
I did some digging into it a bit and compared the old code which is working and new setup which I am trying to do with npm install and I compared the package-lock.json files of both. It is the culprit.
In the old one there are some inter dependencies of prop-types which are not properly installed with new setup using npm install. So, I copied the old package-lock.json and did the package installation and it worked like a charm :)

react-native run-android just rarely works

When I run react-native run-android I get the bellow Error:
BUILD FAILED
Total time: 19.668 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
But after running it for several times and having error, let say about five times, it works!
this process wastes so much of my time, so any suggestion is appreciated.
Install the app manually with adb in your emulator if not installed, then you could just use react-native start to start react native.
This problem occurred to me too.
If you don't have expo app installed on the emulator then download expo app and install it on your emulator, if you don't know how then see this post.
If you have it installed then clear the node cache as mentioned upwards and do npm start don't do npm start android, If don't work again then u reinstall all the packages but u must delete all the packages that are located on C:\Users\YOURUSERNAME\AppData\Roaming\npm and C:\Users\YOURUSERNAME\AppData\Roaming\npm-cache delete all those and then go here and create a new project from scratch, that worked for me.
And if you have expo software application on your computer don't use it ,it mess up your project with updates and so new problems come, just use the terminal.
Goodluck.
What helped me was to occasionally open and build the project using android studio. It will download all the gradle updates and android versions... most of the time I start the emulator from Android studio and the npm start to start the packager.

Vue cli on android

I use a mouthstick to opeate by android tablet(since i am paralysed and cant use a laptop)..
I know front end development and wanted to learn Vuejs2.
So i need to use the CLI that Vue js offers i.e vue-cli
So for the command line interface i downloaded the termux app from play store which is a terminal for Android and file with many Linux packages
Using this i installed nodejs and vue-cli
But for the next step to proceed i ha Ave to execute the command
npm install
And then
npm run dev
The vue-cli is getting installed without any errors but running the npm run dev is giving many errors in the terminal and the app is not being started
What shall i do?
Tried same with learning angular 2 but same issue
Any help and suggestions are appreciated
I ran into a similar problem. It turned out that I had created my project in a directory out side the "storage" directory created by Termux. I don't know the details as to why, but apparently that was the problem. I re-created the vue project in a directory underneath the "storage" directory and those problems resolved. I still haven't gotten the project to run, though. Now I'm getting a single error about an unhandled promise rejection. Still researching that one...

Categories

Resources