世博会,java.net.SocketTimeoutException:连接失败

Bha*_*vel 6 reactjs react-native react-redux expo

我是 React Native Expo 的新手,我需要在我的项目中添加一些新模块。“expo”:“33.0.0”,“react”:“16.8.3”,每当我尝试运行我的项目时,都会出现错误,无法运行该项目。我尝试了所有方法来运行该项目set REACT_NATIVE_PACKAGER_HOSTNAME='192.168.0.102',例如关闭防火墙、允许入站 19000 端口等,但出现错误。

当我进入expo start -c

 Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]
Starting Metro Bundler on port 19001.
Your JavaScript transform cache is empty, rebuilding (this may take a minute).
Your native app is running at exp9c305c55e38f4d0e856f59397620314e://192.168.0.101:19000
Logs for your project will appear below. Press Ctrl+C to exit.
Run Code Online (Sandbox Code Playgroud)

然后我的笔记本电脑和手机连接到相同的网络和相同的 IP,但出现错误,我不知道端口 19000 与我的 wifi 不同

Uncaught Error:java.net.SocketTimeoutException:failed to connect to/192.168.1.20(port 19000)from/192.168.0.102(port 49615) after 10000ms
Run Code Online (Sandbox Code Playgroud)

请给出一些解决方案。

小智 8

它失败是因为端口19000未在防火墙中打开。如果您使用 Linux 操作系统,请运行以下命令打开此端口:

sudo ufw allow 19000/tcp
Run Code Online (Sandbox Code Playgroud)