简体   繁体   English

React-native项目错误“无法连接到开发服务器”

[英]React-native project error “could not connect to development server”

When I run "react-native run-android", it gives me the error: 当我运行“ react-native run-android”时,它给了我错误:

could not connect to development server... 无法连接到开发服务器...

So I had to start my project as follows: 因此,我必须按以下步骤开始我的项目:

  • Going to the android folder running ./gradlew clean 转到运行./gradlew cleanandroid文件夹
  • In root folder react-native run-android . 在根文件夹中, react-native run-android
  • Only after that the project run's. 只有在项目运行之后。

I have to repeat this cycle every time I run my project. 每次运行项目时,我都必须重复此循环。
Is there any permanent solution to get rid of this? 是否有永久性的解决方案可以摆脱这种情况?

Quicker solution: run npm start when you get error could not connect to development server... happens. 更快的解决方案:出现错误时could not connect to development server...运行could not connect to development server... ,请运行npm start

A permanent solution may require you to reinstall or update most of your dev tools. 永久性解决方案可能需要您重新安装或更新大多数开发工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM