网络响应超时错误 (create-react-native-app) (expo)

2024-04-16

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

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

创建反应本机应用程序测试

然后我执行了

npm 启动

然后从expo应用程序扫描二维码。

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

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 https://github.com/react-community/create-react-native-app/issues/144#issuecomment-296631692


这是由于您的计算机未打开端口。

Linux(Ubuntu)

在 Ubuntu 终端中运行

sudo ufw status verbose 要查看开放端口,如果找不到开放的 19000 端口,则需要使用以下命令打开端口

sudo ufw allow 19000/tcp

然后再次运行

sudo ufw allow 19001/tcp

为了为React Native提供http服务,我使用这种方法在我的ubuntu中解决了这个问题。我希望这能帮到您。

Windows

在 Windows 防火墙中打开端口以进行 TCP 访问 上Start菜单,单击Run, type WF.msc,然后单击OK.

In the 具有高级安全性的 Windows 防火墙, 在里面左窗格, 右键点击入境规则,然后单击New Rule在操作窗格中。

In the 规则类型对话框中,选择Port,然后单击Next.

In the 协议和端口对话框中,选择TCP。选择特定本地端口,然后输入React端口实例的端口号,例如19000对于默认实例。点击Next.

In the Action对话框中,选择允许连接,然后单击Next.

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

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

同样可以打开端口19001 too.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

网络响应超时错误 (create-react-native-app) (expo) 的相关文章

随机推荐