React Native 应用程序未在 Expo 应用程序中启动 [英] React Native app does not start in Expo app

查看:20
本文介绍了React Native 应用程序未在 Expo 应用程序中启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了带有 Expo 的 HTC M8s,我想在上面测试我用 React Native 编写的应用程序.我在控制台中运行我的应用程序,扫描二维码并尝试从我的智能手机连接到我的应用程序 - 不幸的是,我看到一个错误,提示它无法加载 exp://myaddress:port.

I have HTC M8s with Expo installed on which I want to test my apps written in React Native. I run my app in a console, scan QR code and try to connect to my app from my smartphone - unfortunately, I see an error saying that it could not load exp://myaddress:port.

我使用的是 Windows 10,我的电脑和智能手机都连接到同一个 WiFi 网络.

I am using Windows 10 and both my PC and my smartphone are connected to the same WiFi network.

这是 ipconfig 命令的结果:

Ethernet adapter Ethernet:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : myhostname.net

Wireless LAN adapter Wi-Fi:
   Connection-specific DNS Suffix  . : myhostname.guest
   Link-local IPv6 Address . . . . . : fe80::8136:d112:d190:5fd8%17
   IPv4 Address. . . . . . . . . . . : 10.168.4.171
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.168.4.1

Ethernet adapter Ethernet 6:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 1:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Ethernet 3:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Bluetooth Network Connection:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Tunnel adapter Local Area Connection* 11:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::1c40:2198:f557:fb54%11
   Default Gateway . . . . . . . . . :

这是运行npm start的结果:

(...) Or enter this address in the Expo app's search bar:

  exp://10.168.4.171:19000

很遗憾,我无法从智能手机中安装的 Expo 应用访问我的应用.

Unfortunately, I can't access my app from Expo app installed in my smartphone.

我已经试过了:

  • 在我的电脑上卸载了 VirtualBox
  • 更改了网络适配器的优先级,使 WiFi 具有最高优先级

我仍然无法通过 Expo 应用程序运行我的应用程序.但是,在我的 PC 上安装 Expo 应用程序解决了这个问题 - 它显示的 QR 码与控制台上的不同,我可以运行我的 react 本机应用程序,但我想从智能手机的 Expo 应用程序运行我的应用程序.

And I am still unable to run my app via Expo app. However, installing Expo app on my PC solved the problem - it shows different QR code than the one on console and I can run my react native app, but I would like to run my app from Expo app from my smartphone.

我在另一台装有 Win10 的电脑上试了试.安装 create-react-native-app,运行它,它通过 WiFi 完美运行.

I tried on another PC with Win10. Installed create-react-native-app, ran it and it worked perfectly through WiFi.

推荐答案

来源:https://github.com/react-community/create-react-native-app/issues/60#issuecomment-317104728我阅读了 Himujjal's 解决方案,它适用于我:以下步骤肯定会有所帮助.我遇到了同样的问题,并且能够在我的 Windows 10 操作系统中解决它.我的计算机上安装了 Virtual Box,但无法在我的 android expo 客户端中运行 CRNA.所以,

Source: https://github.com/react-community/create-react-native-app/issues/60#issuecomment-317104728 I read Himujjal's solution and it works with me: The following steps will definitely help. I had the same problem and was able to solve it in my Windows 10 OS. I had Virtual Box installed on my computer and I was not able to run CRNA in my android expo client. So,

  1. 首先我通过移动热点连接了我的笔记本电脑.
  2. 然后控制面板 >(搜索网络连接")> 网络连接
  3. 右键单击Wifi"> 选择属性">Internet 协议版本 4 (TCP/IPv4)"[不要取消选中标记]
  4. 转到属性">高级...">(取消选中自动度量")>在其下方的文本框中输入(接口度量):10.
  5. 点击确定,确定,确定:)
  6. 然后对其他Virtual Box-xxxxx"网络执行相同操作.而是将 20 放在 Interface Metric 文本框中.
  7. 单击确定"、确定"和确定".

尝试在 Expo 上重新启动您的应用.它现在必须工作!

Try restarting your app on Expo. It must work now!

这篇关于React Native 应用程序未在 Expo 应用程序中启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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