cli icon indicating copy to clipboard operation
cli copied to clipboard

Metro Bundler immediately closes after react-native run-android

Open thecodrr opened this issue 7 years ago • 85 comments

Environment

System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 8.99 GB / 15.89 GB
  Binaries:
    Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  SDKs:
    Android SDK:
      Android NDK: 18.1.5063045
  IDEs:
    Android Studio: Version  3.3.0.0 AI-182.5107.16.33.5264788
react-native-cli: 2.0.1
react-native: 0.60.0

Description

Doing yarn react-native run-android opens the metro bundler but it immediately closes. Don't know if its a bug with the cli or the metro itself. This only happens on Windows, I think.

Things I have tried:

  1. Restarting my system
  2. Clearing cache etc.

Reproducible Demo

  1. Create a new project using react-native init
  2. Run yarn react-native run-android

thecodrr avatar Jul 05 '19 14:07 thecodrr

I'm not too sure if this is the correct solution but opening an new console and running

npx react-native start

works for me.

jmmwangi007 avatar Aug 09 '22 08:08 jmmwangi007

I had the same issue.The Metro runs on port 8081.But something else running was running on the port.I resolved by killing that process.refer https://reactnative.dev/docs/troubleshooting for more info

khadeshyam avatar Jan 30 '23 13:01 khadeshyam

Was a permanent fix ever found for this problem, I'm still experiencing it. RN version : 0.71.8 RN CLI version: 2.0.1

MattNic2 avatar Jul 20 '23 00:07 MattNic2

Hey @MattNic2, mind upgarding to the latest version of RN? We fixed few things around starting packager in run-android.

szymonrybczak avatar Jul 20 '23 05:07 szymonrybczak

For me, quitting the Docker solves my issue.

bertdida avatar Aug 10 '23 15:08 bertdida