Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The development server returned response error code: 500 in react native

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:\Users\ch-e00925\AppData\Roaming\npm
`-- [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:\Myntra\node_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:\Myntra\node_modules\react-nat
ive-material-design\lib\config.js: Module does not exist in the module map or in
 these directories:
  E:\Myntra\node_modules\react-native-material-design\node_modules
,   E:\Myntra\node_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

like image 798
N Sharma Avatar asked Jan 23 '17 09:01

N Sharma


People also ask

What is error 500 in react native?

The development server returned response error code: 500. react-native android error Unable to resolve module `AccessibilityInfo` from.., Module `AccessibilityInfo` does not exist in the Haste module map.

What is http500?

The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request. This error is usually returned by the server when no other error code is suitable.


3 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]

like image 101
jiar wang Avatar answered Oct 23 '22 09:10

jiar wang


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.

like image 8
Emilio Rodriguez Avatar answered Oct 23 '22 07:10

Emilio Rodriguez


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 ...........!

like image 8
Rahul Jograna Avatar answered Oct 23 '22 08:10

Rahul Jograna