React Native app does not start in Expo app

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 02:54:04

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. first I connected my laptop through my mobile hotspot.
  2. Then Control Panel > (search for 'network connections') > network connections
  3. Right-Click on 'Wifi' > select 'Properties' > 'Internet Protocol Version 4 (TCP/IPv4)' [don't uncheck the mark]
  4. Go to "Properties" > "Advanced..." > (Uncheck 'Automatic Metric') > Type in the text-box below that (Interface Metric) : 10.
  5. Click OK and OK and OK :)
  6. Then do the same for the other "Virtual Box-xxxxx" networks. But instead put 20 in the Interface Metric text-box.
  7. Click OK, OK and OK.

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

I am not sure if you already found out the answer but I hope this may help someone who is facing the same situation. The culprit is the network adapter. There is something known as interface metric of a network adapter, the lower the interface metric the higher the priority of the adapter. I am writing this answer from windows perspective. As you have mentioned that your pc and your phone are connected to the same wi-fi network, the reason you are not able to access the app on your mobile is because the local ip you are getting when you start the server is not allocated to the adapter you want.

  • The below solution worked for me:
    1. Launch command prompt as an administrator, type powershell.
    2. Type Get-NetIPInterface: This will give you a list of network adapters, their index numbers and their interface metrics
    3. Change the interface metric of wirelss adapter to the minimum by the following command: Set-NetIPInterface -InterfaceIndex "your_wifi_adapter_interface_index" -InterfaceMetric "MinimumValue"
    4. Type "r" in the console tab where npm is opened so that it will reboot the packager.
    5. Voila! It works.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!