Solve Could not connect to development server Error in React Native

React Native runs on backhand server which starts when we apply the react-native run-android or react-native run-ios command on our command prompt screen. This command start will build up our Gradle project and start synchronizing the whole package using JS server. So when we close the server window this development server Error occurs.

Could not connect to development server error should look like below image :

server Error

The message with this error should look below :-

Could not connect to development server.

Try the following to fix the issue :

  • Ensure the packager server is running.
  • Ensure your device/ emulator is connected to your machine and has USB debugging enabled – run ‘adb devices’ to see a list of connected devices.
  • Ensure airplane mode is disabled.
  • If you’re on a physical device connected to the machine , run ‘adb reverse tcp:8081’ to forward request from your device.
  • If your device is on the same Wi-Fi network, Set ‘Debug server host & Port for device’ in ‘Dev settings’ to your machine IP address and the port of your local Dev server – e.g. 10.0.1.1:8081 .

How to Solve Could not connect to development server Error in React Native :

1. This error occurs when we close the server command prompt window by mistake . The server command window should look like this :

2. So there is no need to close and recompile the whole project again. All you have to do is select your command prompt window ” In which you have applied the  react-native run-android ” command.

3. Type react-native start command like i did in below screen shot. This command should start your development server instantly. Now just press twice the R key to again run your project on emulator.

Here you go now your error should solve. 🙂

7 Comments

  1. Thanks great. You solved my problem

  2. tks so much…

  3. not solved my problem I still have my problem

  4. New ui is good but v0.60 have many issues, like
    “The development server returned response error code: 500 “, for the newly initiated app as we if we migrate old version in to new one then also same issues are occurring, how to get solved from this issue?

    ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)::ffff:127.0.0.1 – – [18/Jul/2019:06:18:55 +0000]”GET /index.bundle?platform=android&dev=true&minify=false HTTP/1.1″ 500 – “-” “okhttp/3.12.1”
    error: bundling failed: Error: Unable to resolve module ./../../../../../../.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/react-transform-hmr/lib/index.js from /project_directory/node_modules/react-native/Libraries/ART/ReactNativeART.js. Indeed, none of these files exist:
    * /home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/react-transform-hmr/lib/index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
    * /home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/react-transform-hmr/lib/index.js/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
    at ModuleResolver.resolveDependency (/home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (/home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:283:16)
    at Object.resolve (/home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/metro/src/lib/transformHelpers.js:264:42)
    at dependencies.map.result (/home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:399:31)
    at Array.map ()
    at resolveDependencies (/home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:18)
    at /home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:269:33
    at Generator.next ()
    at asyncGeneratorStep (/home_directory/.nvm/versions/node/v11.14.0/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)

    ??

Leave a Reply

Your email address will not be published. Required fields are marked *