问题描述
我正在尝试在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
然后我执行了
然后从expo应用程序扫描了二维码.
then scanned the qr code from expo app.
但是在扫描QR码后,出现以下错误:
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 Run In终端中
In Ubuntu Run In terminal
sudo ufw status verbose
要查看打开的端口(如果找不到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 allow 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访问在开始菜单上,单击 Run
,键入 WF.msc
,然后单击 OK
.
To open a port in the Windows firewall for TCP accessOn the Start menu, click Run
, type WF.msc
, and then click OK
.
在具有高级安全性的Windows防火墙中,在左窗格中,右键单击 Inbound Rules ,然后单击 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)(博览会)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!