git 开发服务器返回响应错误代码 500 - react native - ./configs/main

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45733527/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:51:19  来源:igfitidea点击:

the development server returned response error code 500 - react native - ./configs/main

androidgitreactjsreact-native

提问by gaback

I got this error when i tried to make hello-worldsample:
react-native init hello_world cd hello_world react-native run-android

当我尝试制作hello-world样品时出现此错误:
react-native init hello_world cd hello_world react-native run-android

Even when I ran:
npm install -g react-native-git-upgrade react-native-git-upgrade
I got same error on commend line console. enter image description here

即使我跑了:
npm install -g react-native-git-upgrade react-native-git-upgrade
我在commend line console. 在此处输入图片说明

I've searched and tried many solutions but it doesn't seem to work: Example:
* upgrade react-native
* using watchman watchman watch-del-all
* remove node_modules
* clean cache npm cache cleanor npm start -- --reset-cache

我已经搜索并尝试了许多解决方案,但它似乎不起作用:例如:
* upgrade react-native
* 使用守望者watchman watch-del-all
* 删除node_modules
* 清理缓存npm cache cleannpm start -- --reset-cache

Operation: Window 8
react-native-cli: 2.0.1
react-native: 0.44.2 ( tried 0.47.1 too )
Android: Simulator Nexus5X

操作:Window 8
react-native-cli: 2.0.1
react-native: 0.44.2 ( 也尝试过 0.47.1 )
Android: Simulator Nexus5X

Thank you all in advance!

谢谢大家!

回答by Paras Watts

Delete babel-preset-react-nativefolder inside node_modulesand then install older version 2.1.0 of this library with npm install [email protected] --save-dev.

删除babel-preset-react-native里面的文件夹node_modules,然后安装这个库的旧版本 2.1.0 npm install [email protected] --save-dev

回答by MRX

In case if someone is using react-native: 0.57.1 or the latest one,babel-preset-react-native has been replaced by metro-react-native-babel-preset. if you still get 500 error while connecting to the device do the below step and I guess things will be fine

如果有人使用 react-native: 0.57.1​​ 或最新版本,babel-preset-react-native 已被 Metro-react-native-babel-preset 取代。如果在连接到设备时仍然出现 500 错误,请执行以下步骤,我想一切都会好起来的

npm add @babel/runtime
npm install

回答by Cevin Ways

For me it's about the react native version. I just install the new version of react native "0.59.2" then i downgrade to previous version to "0.55.2", and everything works fine.

对我来说,这是关于本机版本的反应。我只是安装了新版本的 react native“0.59.2”,然后我降级到以前的版本到“0.55.2”,一切正常。

回答by Ravichandra S V

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