网络响应超时错误 (create-react-native-app) (expo) [英] Network Response Time Out Error (create-react-native-app) (expo)

查看:25
本文介绍了网络响应超时错误 (create-react-native-app) (expo)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 android 中的 expo 应用程序上运行 create-react-native-app.

I am trying to run create-react-native-app on expo app in android.

首先,我通过编写命令创建了项目

Firstly ,I created the project by writing command

create-react-native-app 测试

create-react-native-app test

然后我执行了

npm 启动

然后从expo app扫描二维码.

then scanned the qr code from expo app.

但扫描二维码后,出现以下错误:

But after scanning QR code , I am getting following error:

Uncaught Error: Java.net,sockettimeoutException: failed to connect to after 10000ms

Github 问题:

https://github.com/react-community/create-react-native-app/issues/144#issuecomment-296631692

推荐答案

这是因为你的机器没有打开端口.

This is due to not open port from your machine.

在 Ubuntu 中运行终端

In Ubuntu Run In terminal

sudo ufw 状态详细如果找不到打开的 19000 端口,要查看打开的端口,则需要使用

sudo ufw status verbose To view open port if you cannot found 19000 port open then you need to open port using

sudo ufw allow 19000/tcp

然后再次运行

sudo ufw 允许 19001/tcp

为反应原生提供 http 我使用这种方法在我的 ubuntu 中解决了这个问题.我希望这会帮助你.

to serve http for react native i solve this problem in my ubuntu using this method. I hope this will help you.

在 Windows 防火墙中打开一个端口以进行 TCP 访问在开始菜单上,点击运行,输入WF.msc,然后点击确定.

To open a port in the Windows firewall for TCP access On the Start menu, click Run, type WF.msc, and then click OK.

高级安全Windows防火墙左窗格中,右键单击入站规则,然后单击New Rule 在操作窗格中.

In the Windows Firewall with Advanced Security, in the left pane, right-click Inbound Rules, and then click New Rule in the action pane.

规则类型对话框中,选择端口,然后点击下一步.

In the Rule Type dialog box, select Port, and then click Next.

协议和端口对话框中,选择TCP.选择特定本地端口,然后输入React端口实例的端口号,如19000为默认实例.点击下一步.

In the Protocol and Ports dialog box, select TCP. Select Specific local ports, and then type the port number of the instance of the React port, such as 19000 for the default instance. Click Next.

操作对话框中,选择允许连接,然后点击下一步.

In the Action dialog box, select Allow the connection, and then click Next.

配置文件对话框中,选择要连接到数据库引擎时描述计算机连接环境的任何配置文件,然后单击下一步.

In the Profile dialog box, select any profiles that describe the computer connection environment when you want to connect to the Database Engine, and then click Next.

名称对话框中,键入此规则的名称和说明,然后单击完成.

In the Name dialog box, type a name and description for this rule, and then click Finish.

同样,您也可以打开端口 19001.

Similarly you can open port 19001 too.

这篇关于网络响应超时错误 (create-react-native-app) (expo)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆