The development server returned response error code: 500 in react-native
解决在运行react-native项目时出现的问题:The development server returned response error code: 500 in react-native
我想很多小伙伴在运行react-native都会出现这种问题。百度了很久查到以下方法:
1.
npm uninstall babel-preset-react-native
npm install [email protected] —save
2.
yarn remove babel-preset-react-native
yarn add [email protected]
如果还没得到解决,也可以重新安装node_modules(npm install),有时候可能是网络原因node依赖包没有下载全,在试了以上方法还未解决的小伙伴,可以尝试最后一种解决方法:
首先执行,获取版本号:
C:\WINDOWS\system32> react-native -v react-native-cli
2.0.1反应原生:0.56.0然后我卸载了react-native:
C:\WINDOWS\system32> npm uninstall -g react-native-cli在3.999s中删除了41个包安装react-native:
npm install [email protected]然后我安装了react-native-cli:npm install -g [email protected]
最后使用此安装来创建react-native项目:
react-native init –version=”0.55.4” myProjectName
希望此片文章能对刚刚入坑react-native的小伙伴有帮助^_^