React Native - 开发服务器返回响应错误代码:404 [英] React native - The development server returned respose error code:404
问题描述
我正在尝试创建简单的 react-native 项目,我还阅读了有关 RR- 重新加载 js 代码的信息,而无需在更改后再次运行它.我的问题是,当我更改 index.android.js 文件中的代码时,我需要运行:
<代码>1.`react-native run-android`2. `curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"`3. `react-native run-android 再次.`
如果我只运行 react-native run-android
代码不会更新!我还尝试隐藏设备并单击 reload
选项而不运行 react-native run-android
命令,但它没有重新加载我得到这样的错误:开发服务器返回响应错误代码:404,
我寻找了有关此错误的一些解决方案,并发现我需要将开发设置调试服务器主机和设备端口"配置为我的本地 IP 地址,我尝试将其更改为:10.0.0.3 -> 我的本地 IP 地址,但仍然出现错误,也改成:10.0.0.3:8080->添加端口,但是什么都没有...还是出现错误,
在错误解释中,我看到我可以尝试运行 adb reverse tcp:8081 tcp:8081
命令,但什么都没有...它不能解决错误,
有人知道我该如何解决这个问题吗?
您好像打开了另一个应用,然后又回到了上一个应用.无论如何要解决这个问题,只需杀死端口 8081 上的所有现有进程并再次运行代码:
对于 Linux/Ubuntu 系统,您可以这样做:
sudo kill $(sudo lsof -t -i:8018)
<块引用>
此后再次运行android应用
react-native run-android
I'm trying to create simple react-native project, Also I read about the RR- reload the js code without run it again after changes. My problem is that when I change the code in index.android.js file I need to run:
1. `react-native run-android`
2. `curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"`
3. `react-native run-android again.`
If I run only react-native run-android
the code isn't update!
Also I tried to stash the device and click on reload
option without run react-native run-android
command, but it's not reloading I got error like this:The development server returned respose error code:404,
I looked for some solution about this error, and find out that I need to configure the Dev Settings "debug server host & port for device" to my local ip address, I treid to change it to : 10.0.0.3 -> my local Ip address, but still get errors, Also changed it to :10.0.0.3:8080-> add the port, but nothing... the errors still appears,
In the error explantion I saw that I can try to run adb reverse tcp:8081 tcp:8081
command, but nothing... its not resolve the errors,
Is someone has any idea how can I resolve this issue?
Looks like you switched on another app and came back again on previous one. Anyway to solve this issue just kill all existing process those are on port 8081 and run code again:
For Linux/Ubuntu system you can do this :
sudo kill $(sudo lsof -t -i:8018)
After this run android app again
react-native run-android
这篇关于React Native - 开发服务器返回响应错误代码:404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!