I create a hotspot with my laptop's wireless card and the ip is 192.168.191.1
, my cell phone 's ip is 192.168.191.2
but when i run this command:
> create-react-native-app AwesomeProject && cd AwesomeProject && npm start
the expo use Ethernet adapter's id 10.101.109.228
not the hotspot's ip 192.168.191.1
how can i set the ip to 192.168.191.1
?
i serach something about packagerOpts
, but it turn out to be this https://github.com/expo/expo-docs/issues/90 :(
> ipconfig
Windows IP Configuration
Ethernet adapter 以太网:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::5d18:e648:e0d0:68b3%17
IPv4 Address. . . . . . . . . . . : 10.101.109.228
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.101.109.254
Ethernet adapter VirtualBox Host-Only Network:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::30ba:c035:45a9:4802%11
IPv4 Address. . . . . . . . . . . : 192.168.56.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Wireless LAN adapter WLAN:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter 本地连接* 1:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter 本地连接* 13:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::c935:ad02:6316:f729%19
IPv4 Address. . . . . . . . . . . : 192.168.191.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
found the answer
https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#configuring-packager-ip-address
in the source code, there have any other way:
Looks like Expo just pick the first network, It pick my VMWare Network... Confusing
Found another way, adjust network order, let it be the first. https://www.ithome.com/html/win10/253612.htm
Most helpful comment
found the answer
https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#configuring-packager-ip-address
in the source code, there have any other way: