Closed Haegin closed 7 years ago
hello! we use node-ip ip.address()
, which in turn calls node's os.networkInterfaces() and then picks the first network interface. docker or hardware interfaces can sometimes cause problems with this, i'm not sure how the ordering of these is determined by the operating system. open to ideas for heuristics we can use, i'm not sure how we can pick from several network interfaces and know which one you'd like to use. so, it's easiest for you to configure the ip address that works if you have multiple network interfaces, and for that we expose REACT_NATIVE_PACKAGER_HOSTNAME
In my case the problem is that I'm running vagrant on VirtualBox which is creating two additional Ethernet adapters which are listed before physical Wireless adapter and so picked by the start script.
I think this can be fixed either by
To be precise, IP picked by start script is 192.168.56.1
instead of 192.168.8.100
.
When I run os.networkinterfaces()
it shows
Why not rather than specify an IP address in the env variables, specify a network interface (or MAC address or other identifier)?
I have the common situation that when I take my laptop to different locations, I have to constantly reconfigure this IP address for my local wifi.
As expo recommends using Genymotion for emulation which is running on VirtualBox, this issue will probably come up more often
if you're having a trouble with this please consider sending a PR to help us improve it. I personally have never encountered this issue and cannot empathize well with it because I can't even re-create it. alternatively, you can use exp
(http://github.com/expo/exp) or xde
(https://github.com/expo/xde) to open your project -- they will automatically create a tunnel using ngrok
, which lets you just forget about any of these issues.
I have the same issue here. The awkward (mine is 192.168.56.1:19000) is the first virtual network that I have to use with my Vagrant. I also don't know how to rearrange it.
Same issue here.... I generate QRcode (http://fr.qr-code-generator.com/) with my WiFi IP as reported by ipconfig and it worked.
It's true that my network config is a bit tricky ... Looking forward to have a solution about that.
Thanks beforhand.
ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection 8: Ethernet adapter Local Area Connection 7: Wireless LAN adapter Wireless Network Connection 2: Ethernet adapter Local Area Connection 3: Ethernet adapter Local Area Connection: Wireless LAN adapter Wireless Network Connection: ... IPv4 Address. . . . . . . . . . . : 192.168.0.101 ... Ethernet adapter VirtualBox Host-Only Network: Ethernet adapter VirtualBox Host-Only Network #4: Ethernet adapter VirtualBox Host-Only Network #5: Ethernet adapter VMware Network Adapter VMnet1: Ethernet adapter VMware Network Adapter VMnet8: Ethernet adapter VirtualBox Host-Only Network #6: Tunnel adapter isatap.{SOME_UUID_VALUE_1}: Tunnel adapter Local Area Connection* 12: Tunnel adapter isatap.{SOME_GUID_VALUE_2}: Tunnel adapter isatap.{SOME_GUID_VALUE_3}: Tunnel adapter isatap.{SOME_GUID_VALUE_4}: Tunnel adapter isatap.SOME_SERVER_HOST_NAME: Tunnel adapter isatap.localdomain: Tunnel adapter isatap.{SOME_GUID_VALUE_5}: Tunnel adapter isatap.{SOME_GUID_VALUE_6}: Tunnel adapter isatap.{SOME_GUID_VALUE_7}: Tunnel adapter isatap.{SOME_GUID_VALUE_8}: Tunnel adapter isatap.{SOME_GUID_VALUE_9}:
@brentvatne Can you please explain a bit the 'ngrok' based solution? Thanks.
Take a look at this solution, may be helpful: https://github.com/react-community/create-react-native-app/issues/60#issuecomment-317104728
@MrLuje's suggestion works perfectly. Thanks.
On my machine Expo also picks a 172.x.x.x IP address (from my Hyper-V Virtual Ethernet Adapter) instead of my preferred 192.x.x.x IP address. Thus the generated QR links to an unreachable IP.
I was able to to override the IP address being used with:
REACT_NATIVE_PACKAGER_HOSTNAME=192.168.2.143 expo start
Description
When I run
yarn start
Expo starts running my app on 172.16.123.1:19001, which isn't the IP I'm using on the only network I'm connected to. Because of this I can't connect with my device.Expected Behaviour
I ran
yarn start
and was expecting it to start my app on my local machine, listening on the my network interface so I can connect from my phone.Observed Behavior
It started on 172.16.123.1:19001 which isn't the IP of my machine on the only network I'm connected to.
My IP address is 172.46.0.206 and I'm not connected to any VPN, nor do I have Docker or any virtualisation software running that may create a dummy network adapter.
Environment
Please run these commands in the project folder and fill in their results:
npm ls react-native-scripts
:npm ls react-native
:npm ls expo
:node -v
: v8.1.0npm -v
:5.0.3yarn --version
: 0.19.1watchman version
:4.7.0Also specify:
Operating system:
Phone/emulator/simulator & version: OnePlus 3 but I can't connect it because of this bug.
Reproducible Demo
create-react-native-app grimoire
cd grimoire
yarn start