EshgheCode
EshgheCode

Reputation: 312

React Native: The development server returned response error code: 500

I tried to run my application on the emulator, the build is successfully done but when the app starts to bundle on about 26% this error pops up to the cmd:

[Mon Nov 08 2021 13:00:11.720]  BUNDLE  ./index.js

error: TypeError: Cannot read properties of undefined (reading 'reduce')
    at resolveDependencies (C:\Users\iarch\Desktop\Directik App\mobile-v2-new\node_modules\metro\src\DeltaBundler\traverseDependencies.js:586:33)
    at C:\Users\iarch\Desktop\Directik App\mobile-v2-new\node_modules\metro\src\DeltaBundler\traverseDependencies.js:275:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\Users\iarch\Desktop\Directik App\mobile-v2-new\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)
    at _next (C:\Users\iarch\Desktop\Directik App\mobile-v2-new\node_modules\metro\src\DeltaBundler\traverseDependencies.js:107:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

and on the emulator splash screen shows up and then red screen appears:

enter image description here

i tried to solve with this versions of node:

17.0.1
16.13.0
16.10.0
14.18.1

and for every single one, I delete node_modules folder and then change my node version with nvs and afterward I run npm install but same thig happened. how can I solve this?

Upvotes: 2

Views: 8560

Answers (5)

Andrew Strauss
Andrew Strauss

Reputation: 37

make sure you have all the required packages installed in your application. I was also getting the same error due to missing package. I installed that package and the error got resolved.

Upvotes: 0

Ash Archin
Ash Archin

Reputation: 451

for me this was due to the way I run project on emulator. if you just run npm run android and wait for bundler to show up on another terminal,try this: open up a terminal and run npm start on it wait for the react logo to show up. then open another terminal and npm run android. I don't know why but this worked in my case.

Upvotes: 5

Muhammad Numan
Muhammad Numan

Reputation: 249

You first nedd to install react native community by given command

npm i @react-native-community/cli

Then you need you install react-timer-mixin as they help us to develop a faster responced server

npm install react-timer-mixin

This might solve your issue

Upvotes: -2

gbalduzzi
gbalduzzi

Reputation: 10176

You may try restarting the bundler without caches:

npm start -- --reset-cache

If this doesn't work, you may need to clear everything and restart the server from there:

watchman watch-del-all && 
rm -rf $TMPDIR/react-native-packager-cache-* &&
rm -rf $TMPDIR/metro-bundler-cache-* && 
rm -rf node_modules/ 
&& npm cache clean --force &&
npm install && 
npm start -- --reset-cache

Taken from: How to clear react-native cache?


If nothing else works, are you sure you don't have an error in your code?

Upvotes: 0

M.Abdullah Iqbal
M.Abdullah Iqbal

Reputation: 221

It's Javascript code error very often found when we are connecting API's and the server is damaged/down so... Useful link is below I found help in Mozila Docx 6.6.1. 500 Internal Server Error The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. Reference Document

https://httpwg.org/specs/rfc7231.html#status.500

Upvotes: 1

Related Questions