React native the development server returned response error code 500

1 vote and 3 comments so far on Reddit

I’m receiving error 500 on android emulator in a simple app without expo. Does someone can help me?

My code has just 2 components:

App.js

import React from 'react';import TodoListPage from './components/pages/todoListPage/TodoListPage' 
const App = () => <TodoListPage /> 
export default App

TodoListPage.jsx

import React, { Component } from 'react';
import { AppRegistry, View } from 'react-native';

const TodoListPage = () => (
      // Try setting `flexDirection` to `column`.
      <View style={{flex: 1, flexDirection: 'row'}}>
        <View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
        <View style={{width: 50, height: 50, backgroundColor: 'skyblue'}} />
        <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
      </View>
    )

export default TodoListPage

Full code: https://github.com/danilosilvadev/jdoit

I’m receiving this error:

The development server returned response error code: 500

URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false

Body:
{"originModulePath":"/home/danilosilvadev/Desktop/code/jdoit/jdoit/App.js","targetModuleName":"./components/pages/todoListPage/TodoListPage","message":"Unable to resolve module `./components/pages/todoListPage/TodoListPage` from `/home/danilosilvadev/Desktop/code/jdoit/jdoit/App.js`: The module `./components/pages/todoListPage/TodoListPage` could not be found from `/home/danilosilvadev/Desktop/code/jdoit/jdoit/App.js`. Indeed, none of these files exist:nn  * `/home/danilosilvadev/Desktop/code/jdoit/jdoit/components/pages/todoListPage/TodoListPage(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`n  * `/home/danilosilvadev/Desktop/code/jdoit/jdoit/components/pages/todoListPage/TodoListPage/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`","errors":[{"description":"Unable to resolve module `./components/pages/todoListPage/TodoListPage` from `/home/danilosilvadev/Desktop/code/jdoit/jdoit/App.js`: The module `./components/pages/todoListPage/TodoListPage` could not be found from `/home/danilosilvadev/Desktop/code/jdoit/jdoit/App.js`. Indeed, none of these files exist:nn  * `/home/danilosilvadev/Desktop/code/jdoit/jdoit/components/pages/todoListPage/TodoListPage(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`n  * `/home/danilosilvadev/Desktop/code/jdoit/jdoit/components/pages/todoListPage/TodoListPage/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`"}],"name":"Error","stack":"Error: Unable to resolve module `./components/pages/todoListPage/TodoListPage` from `/home/danilosilvadev/Desktop/code/jdoit/jdoit/App.js`: The module `./components/pages/todoListPage/TodoListPage` could not be found from `/home/danilosilvadev/Desktop/code/jdoit/jdoit/App.js`. Indeed, none of these files exist:nn  * `/home/danilosilvadev/Desktop/code/jdoit/jdoit/components/pages/todoListPage/TodoListPage(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`n  * `/home/danilosilvadev/Desktop/code/jdoit/jdoit/components/pages/todoListPage/TodoListPage/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`n    at ModuleResolver.resolveDependency (/home/danilosilvadev/Desktop/code/jdoit/jdoit/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:161:851)n    at ResolutionRequest.resolveDependency (/home/danilosilvadev/Desktop/code/jdoit/jdoit/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:91:16)n    at DependencyGraph.resolveDependency (/home/danilosilvadev/Desktop/code/jdoit/jdoit/node_modules/metro/src/node-haste/DependencyGraph.js:272:4579)n    at dependencies.map.relativePath (/home/danilosilvadev/Desktop/code/jdoit/jdoit/node_modules/metro/src/DeltaBundler/traverseDependencies.js:376:19)n    at Array.map (<anonymous>)n    at resolveDependencies (/home/danilosilvadev/Desktop/code/jdoit/jdoit/node_modules/metro/src/DeltaBundler/traverseDependencies.js:374:16)n    at /home/danilosilvadev/Desktop/code/jdoit/jdoit/node_modules/metro/src/DeltaBundler/traverseDependencies.js:212:33n    at Generator.next (<anonymous>)n    at step (/home/danilosilvadev/Desktop/code/jdoit/jdoit/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:313)n    at /home/danilosilvadev/Desktop/code/jdoit/jdoit/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:473"}
processBundleResult
    BundleDownloader.java:266
access$200
    BundleDownloader.java:35
onResponse
    BundleDownloader.java:153
execute
    RealCall.java:135
run
    NamedRunnable.java:32
runWorker
    ThreadPoolExecutor.java:1113
run
    ThreadPoolExecutor.java:588
run
    Thread.java:818

I am using react-native framework for developing my android app. I want to use react-native-material-design library for making Toolbar with some more features.

I installed this library in current directory where my project is using below command :-

E:>npm i react-native-material-design -g --save
C:Usersch-e00925AppDataRoamingnpm
`-- [email protected]
  +-- [email protected]  (git+https://github.com/react-n
ative-material-design/react-native-material-design-styles.git#bdc029c1a1c83ff563
d10868be38b8aed1e9989b)
  `-- [email protected]
    +-- [email protected]
    `-- [email protected]
      +-- [email protected]
      | +-- [email protected]
      | | `-- [email protected]
      | `-- [email protected]
      +-- [email protected]
      +-- [email protected]
      +-- [email protected]
      +-- [email protected]
      | `-- [email protected]
      |   `-- [email protected]
      +-- [email protected]
      | +-- [email protected]
      | | +-- [email protected]
      | | `-- [email protected]
      | |   `-- [email protected]
      | `-- [email protected]
      |   +-- [email protected]
      |   | +-- [email protected]
      |   | +-- [email protected]
      |   | | `-- [email protected]
      |   | |   `-- [email protected]
      |   | +-- [email protected]
      |   | `-- [email protected]
      |   |   `-- [email protected]
      |   +-- [email protected]
      |   | +-- [email protected]
      |   | +-- [email protected]
      |   | | `-- [email protected]
      |   | +-- [email protected]
      |   | `-- [email protected]
      |   |   +-- [email protected]
      |   |   | `-- [email protected]
      |   |   `-- [email protected]
      |   `-- [email protected]
      +-- [email protected]
      +-- [email protected]
      +-- [email protected]
      +-- [email protected]
      | +-- [email protected]
      | `-- [email protected]
      |   `-- [email protected]
      +-- [email protected]
      +-- [email protected]
      +-- [email protected]
      `-- [email protected]
        `-- [email protected]


E:>

After this I am getting one issue while running a application, it is may be library was not installed successfully.

E:Myntra>react-native start
Scanning 557 folders for symlinks in E:Myntranode_modules (114ms)
 ┌────────────────────────────────────────────────────────────────────────────┐

 │  Running packager on port 8081.                                            │

 │                                                                            │

 │  Keep this packager running while developing on any JS projects. Feel      │

 │  free to close this tab and run your own packager instance if you          │

 │  prefer.                                                                   │

 │                                                                            │

 │  https://github.com/facebook/react-native                                  │

 │                                                                            │

 └────────────────────────────────────────────────────────────────────────────┘

Looking for JS files in
   E:Myntra

[01/23/2017, 13:36:07] <START> Initializing Packager
[01/23/2017, 13:36:08]         HMR Server listening on /hot

React packager ready.

[01/23/2017, 13:36:12] <START> Requesting bundle
                               bundle_url: /index.android.bundle?platform=androi
d&dev=true&hot=true&minify=false
[01/23/2017, 13:36:40] <START> Building Haste Map
[01/23/2017, 13:36:40] <END>   Building Haste Map (141ms)
[01/23/2017, 13:36:40] <END>   Initializing Packager (33314ms)
[01/23/2017, 13:36:40] <START> Transforming files
transformed 584/607 (96%)(node:6316) UnhandledPromiseRejectionWarning: Unhandled
 promise rejection (rejection id: 605): UnableToResolveError: Unable to resolve
module react-native-material-design-styles from E:Myntranode_modulesreact-nat
ive-material-designlibconfig.js: Module does not exist in the module map or in
 these directories:
  E:Myntranode_modulesreact-native-material-designnode_modules
,   E:Myntranode_modules

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cac
he`.
[01/23/2017, 13:54:09] <START> Requesting bundle
                               bundle_url: /index.android.bundle?platform=androi
d&dev=true&hot=true&minify=false

PS : I am on Windows 7 machine, could not find a way to execute commands. I have seen this The development server returned response error code: 500 in react-native but it did not help me.

Can anyone help me to resolve this issue. Thanks in advance.

enter image description here

19 Answers

babel-preset-react-native make this trouble. Run below orders in your project root dir:

$yarn remove babel-preset-react-native

$yarn add [email protected]

try installing react-native-material-design locally instead of globally.

It looks like react-native-material-design depends on react-native-material-design-styles which won’t be packaged by React Native’s bundler since its parent is a global module.

I had the same issue with port 8081, change it to 8082. because its already being used by some other service here is step its work for me

First run your package server:
Blockquote

react-native start --port 8082

Open another command prompt, start the Android app as usual:

react-native run-android

Once it finishes, now rewrite the tcp port that adb tunnels:

adb reverse tcp:8081 tcp:8082

See the list of adb tcp tunnels:

adb reverse --list

Now You should now see a message like:

(reverse) tcp:8081 tcp:8082

check your app it will run ………..!

Sometime this error arise when you don’t specify the correct path of .js files

Like instead of typing the Correct path :

var WeatherProject = require('./Main/WeatherProject');

A Wrong Path is typed (capitalization,spelling error,special symbols) :

var WeatherProject = require('./WeatherProject');
  • Go to your root project
  • Open powershell
  • Run npm start —–reset-cache
  • When it is done, don’t close it & open another powershell in your project’s root directory at the same time
  • Run react-native run-android

One of the reasons why I was having this error was because I imported ‘react-native’ library twice.

import { View, Text, ActivityIndicator } from "react-native";
import { View, Text, ActivityIndicator, TouchableOpacity, StyleSheet } from "react-native";

I don’t know If this can really cause this problem but removing the redundant line of import solved this issue for me.

First execute, to get the version number:

C:WINDOWSsystem32>react-native -v react-native-cli

2.0.1 react-native: 0.56.0

Then I uninstalled react-native:

C:WINDOWSsystem32>npm uninstall -g react-native-cli

removed 41 packages in 3.999s

Then I installed react-native:

npm install [email protected]

Then I installed react-native-cli:

npm install -g [email protected]

Then use this installation to create a react-native project:

react-native init --version="0.55.4" myprojectname

I had the same problem, one of my node modules was not well configured (react navigation) so I just re install it locally using

npm install react-navigation --save

Whenever any one get this kind of Error with Error Code 500. Following reason behind this.

1) You might work in Linux system & You have to run application with the terminal & check into the Android Simulator rather in Devices.

2)If you work with above then please make sure your Simulator Wife should be off & then work with Studio It will work perfectly.

Hope you will get the solution.

As a newcomer to the React-native field, I used to face this error loads of times, and I always used to go confused. After a bit of experience though, I realized, it happens when the server tries to import something from a place which doesn’t exist.

So checking what all you are importing and if that thing even exists, must be where you should start.

That means this error doesn’t just pop up for an uninstalled package or so, but even if you are importing the wrong thing or from the wrong place.

1) You might work in Linux system & You have to run application with the terminal & check into the Android Simulator rather in Devices.

2)If you work with above then please make sure your Simulator Wifi should be off & then work with Studio It will work perfectly.

3)Make sure there should be not open multi-pal terminal or command window for at same time. if it then close one

Usually this error is because of file path specified.

I got this error when i gave a wrong file path to the require function of image.

In my case, which was like

image: require('../assets/profile')

then changed to this solved my error,

image: require('./../assets/profile.jpg')

It could be that the name of the JavaScript files that you imported is same with any React predefined libraries/components. For example, importing View.js from folder app/components that you have created.

import View from './app/components/View'

The above statement will produce the error. So, by changing the name of file to Interface.js

import Interface from './app/components/Interface'

Now, the code can run well

If you are using react-native version: 56.0 then downgrade it version 54 .Its worked for me

For those using stores or top level components. If you delete one, then make sure that it’s not being imported anywhere else.

In my case, I deleted a store that was being imported top level.

react-native bundle —platform android —dev false —entry-file index.js —bundle-output android/app/src/main/assets/index.android.bundle —assets-dest android/app/src/main/res

run this command : this will show the error like twice closing of tags or unable to find any module

use sudo before the command in linux based systems

For those using stores or top level components. If you delete one, then make sure that it’s not being imported anywhere else.

In my case, I deleted a store that was being imported top level.

Same error. Different case.

This error happened to me when i changed the «name» to lowercase in package.json file in Redux folder.

I did it inorder to fix the following error, which arises due to the npm convention, where they allow only lowercase { "message": "String does not match the pattern of "^(?:@[a-z0-9-*~][a-z0-9-*._~]*/)?[a-z0-9-~][a-z0-9-._~]*$".", }

So inorder to fix the problem i changed
{ "name": "Redux" }
to

{
    "name": "redux"
}

and that’s when the server error came. I changed it back to

{
    "name": "Redux"
}

and then it is working fine.

I’m trying to develop a new project with React Native. But I have little knowledge of React Native. I did all the setups correctly. But I can not build from emulator. Can you help me? I get an error like this:

The development server returned response error code: 500

URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false

Body:
{«originModulePath»:»C:UserscenkdDesktopreactprojemnode_modulesreact-nativeLibrariesreact-nativereact-native-implementation.js»,»targetModuleName»:»AccessibilityInfo»,»message»:»Unable to resolve module AccessibilityInfo from C:\Users\cenkd\Desktop\reactprojem\node_modules\react-native\Libraries\react-native\react-native-implementation.js: Module AccessibilityInfo does not exist in the Haste module mapnnThis might be related to https://github.com/facebook/react-native/issues/4968nTo resolve try the following:n 1. Clear watchman watches: watchman watch-del-all.n 2. Delete the node_modules folder: rm -rf node_modules && npm install.n 3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache. 4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.»,»errors»:[{«description»:»Unable to resolve module AccessibilityInfo from C:\Users\cenkd\Desktop\reactprojem\node_modules\react-native\Libraries\react-native\react-native-implementation.js: Module AccessibilityInfo does not exist in the Haste module mapnnThis might be related to https://github.com/facebook/react-native/issues/4968nTo resolve try the following:n 1. Clear watchman watches: watchman watch-del-all.n 2. Delete the node_modules folder: rm -rf node_modules && npm install.n 3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache. 4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.»}],»name»:»Error»,»stack»:»Error: Unable to resolve module AccessibilityInfo from C:\Users\cenkd\Desktop\reactprojem\node_modules\react-native\Libraries\react-native\react-native-implementation.js: Module AccessibilityInfo does not exist in the Haste module mapnnThis might be related to https://github.com/facebook/react-native/issues/4968nTo resolve try the following:n 1. Clear watchman watches: watchman watch-del-all.n 2. Delete the node_modules folder: rm -rf node_modules && npm install.n 3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache. 4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.n at ModuleResolver.resolveDependency (C:UserscenkdDesktopreactprojemnode_modulesmetrosrcnode-hasteDependencyGraphModuleResolution.js:167:1306)n at ResolutionRequest.resolveDependency (C:UserscenkdDesktopreactprojemnode_modulesmetrosrcnode-hasteDependencyGraphResolutionRequest.js:80:16)n at DependencyGraph.resolveDependency (C:UserscenkdDesktopreactprojemnode_modulesmetrosrcnode-hasteDependencyGraph.js:237:485)n at Object.resolve (C:UserscenkdDesktopreactprojemnode_modulesmetrosrclibtransformHelpers.js:116:25)n at dependencies.map.result (C:UserscenkdDesktopreactprojemnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:298:29)n at Array.map ()n at resolveDependencies (C:UserscenkdDesktopreactprojemnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:294:16)n at C:UserscenkdDesktopreactprojemnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:159:33n at Generator.next ()n at step (C:UserscenkdDesktopreactprojemnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:239:307)»}
processBundleResult
BundleDownloader.java:285
access$200
BundleDownloader.java:37
onResponse
BundleDownloader.java:163
execute
RealCall.java:153
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1167
run
ThreadPoolExecutor.java:641
run
Thread.java:764

Build Error

asked Jul 13 ’18 at 23:18

i had the same issue.

my previous react-native version was

C:WINDOWSsystem32>react-native -v
react-native-cli: 2.0.1
react-native: 0.56.0

then i uninstall react-native

C:WINDOWSsystem32>npm uninstall -g react-native-cli
removed 41 packages in 3.999s

then i installed react-native version 0.55.4

npm install react-native@0.55.4

again intsalled reacnative cli 1.2.0

npm install -g react-native-cli@1.2.0

then this installation of creating react-native project work out

react-native init --version="0.55.4" myprojectname

answered Jul 16 ’18 at 11:16

This is a bug on version 0.56. so i suggest you to downgrade from 0.56 to version 0.55
just run this command

npm install react-native@0.55.4 --save

answered Jul 14 ’18 at 1:38

I have been searching and trying everything I can do to fix my react project; for me the solution that really worked is downgrade the react version.

My version was 0.59.2; I got an error 500 code message every time I tried to create a project with that version.

So this is my solution :

npm uninstall -g react-native-cli

then you can install the previous version to 0.55.2

npm install react-native@0.55.2

and then run :

npm install -g react-native-cli@1.2.0

create a new project with previous version :

react-native init --version="0.55.2" yourProjectName

answered Mar 27 at 18:14

Not the answer you’re looking for? Browse other questions tagged javascript node.js react-native or ask your own question.

Понравилась статья? Поделить с друзьями:
  • React native start error
  • React native android network error
  • React key error
  • React hook form set error
  • React hook form error message