Skip to content

The development server returned response error code: 500 #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
samassango opened this issue Sep 11, 2017 · 40 comments
Closed

The development server returned response error code: 500 #401

samassango opened this issue Sep 11, 2017 · 40 comments

Comments

@samassango
Copy link

samassango commented Sep 11, 2017

whatsapp image 2017-09-11 at 08 39 24

Description

I started experiencing this issue after change an expo version from 15.0.0 to 19.0.0

@brentvatne
Copy link
Member

I guess maybe you're using this lib: GeekyAnts/NativeBase#24

anyhow the issue is related to react-native version changes and some code (either yours or a library) depending on some private code in react-native that changed

@samassango
Copy link
Author

I managed to solve this error
The cause of this error is the changes of files location made in react-native dependency which other libraries like native-base point to.

To solve it you need to view the mentioned file and change the file location to the correct location.

@izzateesafia
Copy link

Sorry but @samassango could you please explain a little bit further.

@samassango
Copy link
Author

@izzateesafia Okay this issue occurs in node_modules meaning it's not your code but its some of the dependence which had changed files location example:
If we have modules/components/js/btn.js in a certain library, and it happen that another library use that library as one of it's dependence, then the used library decide to move the change btn.js to button/btn.js. if another app use both dependence this issue will occur. What you need to do is find the correct file location and update the file which can't resolve the previous location with the correct file location. Then its gonna work.
Or
Just implement expo 20.0.0 sdkversion 20.0.0, react-native 0.47.0, and react^16.0.0-alpha.12 then you won't experience that issue.

@guarani
Copy link

guarani commented Oct 30, 2017

For me this error was resolved running yarn in the project folder. The cause may have been due to the fact that I'd switched branches and some of the packages were not installed.

@bethwelt
Copy link

@guarani your solution worked for me,thank you

@rimiti
Copy link

rimiti commented Mar 21, 2018

Be aware if you have an old metro bundler instance running, you should try to restart it.

@arash-hacker
Copy link

for my case i chenged node_module folder in another folder and run it.
that was reason for this issue

@thakursaurabh1998
Copy link

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.

@Navithahk
Copy link

Navithahk commented Jul 11, 2018

restarting the metro bundler works!

@kishanmahor
Copy link

screenshot_2018-07-13-17-57-14-241_com awesomeproject
this is my first app and i got this error .i am using -g react-native-cli

@mazhardev
Copy link

I also have this issue :(

@rodrigos0ares
Copy link

Try run npm start and react-native run-android. Maybe your Metro Bundler isn't started.

@karmicdice
Copy link

karmicdice commented Jul 24, 2018

Expected Output

Running App.

Sets followed:

npm -g install react-native
npm -g install socks
npm -g install react-native-cli

cd /project-directory
react-native init <projectname>

cd projectname

-- Start Android Studio - Run Emulator (API 23) --

react-native run-android

Output:
native-error

Other Info:

react-native -v
react-native-cli: 2.0.1
react-native: 0.56.0
npm -v
5.6.0

node -v
v8.11.3

On Windows 10 Pro - 64 Bit

@kishanmahor
Copy link

kishanmahor commented Jul 24, 2018 via email

@EugeneRaynerNZ
Copy link

Kish that's perfect mate. Thanks a bunch.

@MondeLionel
Copy link

The horror of Android on windows is real. Same issue, metro bundler seems to be fine but issue persists. Time for some tea.

@psatler
Copy link

psatler commented Aug 1, 2018

Thanks a lot @kishanmahor !

@edoantonioco
Copy link

edoantonioco commented Aug 7, 2018

React native on windows seems to be broken, and Kishanmahor workaround to return to an older vesion of react native seems to be the way to make it work.

As a temporary workaround works, but its not something that makes me feel comfortable with react native.

Edit: Seems to be related to facebook/react-native#20353

@prasad456
Copy link

@rcsoares Metro Builder was running, but having the same issue for the sample starting app in react
Please don't mind, I'm a newbie in react-native

@ravichandrasv
Copy link

Downgrade the following:
react-native init Project
cd Project
npm uninstall react-native
npm install --save [email protected]
npm uninstall --save babel-preset-react-native
npm install --save [email protected]
react-native run-android

@albertcjr
Copy link

Issue is due to react-native 0.56

@behzadkhodapanah
Copy link

hello , fast solution is :
1 - delete node_modules folder
2 - edit package json : react-native version to "55.4" or "55.2" and babel-preset-react-native to "4.0.0"
3 - run npm install or yarn install command
4 - you're done 👍

@jerrychong25
Copy link

@kishanmahor methods works for me, thanks a lot!

@aditodkar
Copy link

aditodkar commented Aug 29, 2018

@ravichandrasv @kishanmahor You just saved me today. It works fine for windows 10.

@prasad456
Copy link

@albertcjr as you mentioned "Issue is due to react-native 0.56", then 0.57 will clear this issue?

@hpdeveloper28
Copy link

Strange thing I noted. I can't believe.

App doesn't work when Android device was connected with USB cable.

App started to work normal when I connected with Wifi (Using adb connect command).

Hope it works for you as well.

@osnersanchez
Copy link

I had the same problem as @karmicdice, and solve it with the suggested by @qweasdzxc23, but I reiterate with the question of @prasad456, ¿I would like to know why this problem occurs and what is the reason for this solution?

@cyb3rsalih
Copy link

Restarting Metro Bundler with npm start solved my problem

@md0092651
Copy link

I just started with learning react native and got the same error. This link solved the issue. All the above solution did not work for me

@rizkisunaryo
Copy link

@md0092651 solution works for me.

@bsendras
Copy link

bsendras commented Oct 2, 2018

@md0092651
None of the solutions above worked for me. Finaly I replaced the dependencies in package.json to match the one generated a couple of days ago with react-native init. This is the plane base package.json that works for me, even using react-native 0.57

{
  "name": "someProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.5.0",
    "react-native": "0.57.0"
  },
  "devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.45.3",
    "react-test-renderer": "16.5.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

Notice that

"react": "16.5.0"
"react-native": "0.57.0"

and

"metro-react-native-babel-preset": "0.45.3",
"react-test-renderer": "16.5.0"

works together as required.

Those were the changes in package.json that made it possible to build and run the app in my case.
Hope it helps!

@SulaRanawake
Copy link

I also had this issue. Found out I have misspelled when mentioning a component I have created. But needs them to run. The issue solved after correcting that.

@LuisCabrel
Copy link

The same thing happened to me and the import had doubled, validate that first

@FullDev333
Copy link

Thanks for your asking

@ndukachukz
Copy link

has anyone gotten this error its terrible kept me in for weeks now

@SamuelCvC
Copy link

I spent almost two days trying to fix this issue, I tried so many difficult alternatives and what helped me was a easy one.

I just dowload the node version and download a older one. Simple as that... That works for me, I hope works for ya'll! <3

@cheuchheang
Copy link

I got this problem because the auto-import file path was wrong. So correct the path to solving it.
Anyway, have you guys ever met this kind of auto-import problem?

@aashishpanthi
Copy link

Got the same problem.

I deleted package-lock.json and node_modules then install all packages using yarn add, my problem is now solved.

@iamnomadgg
Copy link

iamnomadgg commented Mar 19, 2023

hello , fast solution is : 1 - delete node_modules folder 2 - edit package json : react-native version to "55.4" or "55.2" and babel-preset-react-native to "4.0.0" 3 - run npm install or yarn install command 4 - you're done 👍

In my first case, as long as I imported the library which I have created (WelcomeScreen) in App.js, I had this problem. After I applied your 1st and 3rd steps, it was solved.
However, as long as I use it in the App.js as , the problem occurs again.

Since the used versions are "react-native": "0.71.3", "@babel/core": "^7.20.0", I couldn't apply your 2nd step. Do you have any idea which versions I should use?

Edit:
I have just found the solution:
https://blog.logrocket.com/troubleshooting-common-react-native-bugs/#import-error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests