Search code examples
reactjsreact-nativebundler

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.


Solution

  • 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: expo bundler image

    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