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
Related
Hey and good day everyone,
when I want to compile and run my react native code in the android platform, it shows up the error as pictures below (app:processDebugMainManifest FAILED)
The system that I currently use is macOS Monterey v12 with apple M1 chips.
I highly encourage you to Use EXPO project manager instead of using pure react native for development and then if you were curious you can eject from it.
Expo give you lot of power with libraries and expo client.
check it out:
https://expo.dev/
I followed expo documentation, but I can't figure out how to run it on an emulator without ejecting. I've heard ejecting is risky and I can't keep making changes to the app if I eject. When I click run, it gives me Error: Module not specified, but there is no module from the dropdown list.
You can run your app on android emulator with expo app on this emulator or make expo build:android and select apk option. Then just download and install apk on any device. You don't able to run expo app in android studio like native app without ejecting. I recommend you not to use Expo at all and have a look on fast line, pure react native app is more flexible and with fast line has almost the same benefits like expo app. Development without expo is not a big deal.
I read from react-primitives readme https://github.com/lelandrichardson/react-primitives#readme, stated that we need to install target platform library to use react-primitives. For windows there is this react-native-windows. If I develop app that uses react-primitives on ElectronJS, is it possible?
I want to develop multi platform app that runs on windows, linux, macOS, android, iOS, and web with one codebase.
Electron is basically a browser. So if you follow the web setup guide for react-primitives it should work perfectly fine.
From the installation follow :
web:
npm install --save react-dom react-native-web react-art
This also means you can have one config for all your needs.
I am a newbie to React Native and I have just started leaning it. During its installation, came across the following commands
npm install -g create-react-native-app
npm install -g react-native-cli
It says that the first one is the easiest way to start building a new React Native application, where as the second is from older mode of installation. How these two ways differ from each other? Which one should be selected especially as a beginner like me to learn React Native? Which one is the best way to install React Native?
The create-react-native-app package is a community-driven package that gives you a basic template for React Native so you can start right away instead of having to set up Babel, Expo (which allows for cross-platform development), etc. It's a great way to start with React Native without having to set up any boilerplate or have an Apple machine for iOS projects. It's a CLI that generates a project for you to start without any hassle.
But create-react-native-app has its limitations. The tradeoff is out-of-box ease for less customizability. That's where react-native-cli comes in. This is the CLI that is used to create new pure React Native projects, run them, etc. This does not include Expo which does not allow for the ease with CRNA nor cross-platform development (you'll have to use an Apple machine for iOS). But with a pure React Native project, you can add native libraries and APIs for your project, which is not possible with CRNA. You can achieve a pure React Native project from a CRNA project by ejecting down the line.
I would suggest CRNA as a starting point because it allows you to use Expo to demo your apps on devices quickly and has support for both Android & iOS, regardless if you have Xcode or not -- without any configuration hassle. But it comes with limitations which you can alleviate with ejecting (but will lose other capabilities).
Okay So I'm extremely confused on how this all works...
I want to run my app on my device and not through Expo.
So I'm reading the Facebook documentation and told me to open up my ios directory and open up the xcode file. While I proceeded to look inside my directory of course I don't find my ios folder...lol (Don't understand why they don't tell us the step to actual create the folder..)
So I'm google and googling and find that I needed to eject. But in that documentation it told me it was permanent... Doesn't sound safe at all.... So I did it anyway and it created my ios folder.
I opened it up on xCode and deploy it to my phone.. Why is that the app looks completely different from the one it ran on expo locally...
If you look at the picture below, they're two different app..lol. Like come on what sort of trickery do I need to go through just to have my app run on my device without going through expo.
Why is it showing 2 different apps?
Future wise, Should I only eject when the app is completely done? Since I can't run it on expo anymore.. hence the permanent changes.. How would I test native device features? This honestly makes no sense.
How to start working on react-native ios without expo.
brew install node
npm install -g react-native-cli
react-native init AwesomeProject
open ios/AwsomeProject.xcodeproj in xcode
You can also install cocoa pod and use AwsomeProject.xcworkspace.
In account add ur ID Apple Id and download certificate manually
In general menu add your apple id and press run
For next time open terminal
cd project
react-native run-ios --device "iPhone"
Note: Write your device instead of iPhone. Hope I made things clear for beginners please feel free to correct me if i am wrong.