React Native: Could not connect to development server
If you are a beginner to React Native then you would have faced this issue at least once. React Native connects with Emulator after Metro generate the build to serve Emulator. below is command which triggers the above process.
react-native run-android // Connect with Android Device or Emulator
react-native run-ios // Connect with IOS Device or Emulator
Lets take simple example with android, the above command run the below shell script which is part of React Native where its actually validate android SDK, Environment and device if exist.
Error: Emulator throws the error “Could not connect to development server” and below is the screenshot.
Solution
Basically this error tells that your current build got failed due to reasons like Code issue or dependency issue.
In order to fix this issue, solution is dead simple is below.
- Cancel the current process of“react-native run-android” by CTRL + C or CMD + C
- Close metro bundler window command line which opened automatically.
- Run the command again, “react-native run-android”
Cool, Isn’t it !!
Happy Coding, Stay tuned for next error with solution !