React Native Expo change default LAN IP

后端 未结 10 1003
星月不相逢
星月不相逢 2020-12-13 09:23

I\'ve got virtual box installed. And when I look at the host > LAN > ip address is exp://192.168.56.1:19000.

How can I change it without disable the network? because

相关标签:
10条回答
  • 2020-12-13 09:48

    Even after you set the custom ip, you still cannot connect the virtual box.

    You need to set a port forward for the virtual mechine at networking setting page.

    Just use the real host mechine ip for the app Expo.

     REACT_NATIVE_PACKAGER_HOSTNAME='real host mechine ip' npm start
    0 讨论(0)
  • 2020-12-13 09:53

    Open CMD from your Project Directory and Run Command as set REACT_NATIVE_PACKAGER_HOSTNAME=192.168.0.12. Replace the ip with your own LAN ip address. The Command set is used to set the Environment variable locally, without defining it into Environment Variables.

    0 讨论(0)
  • 2020-12-13 09:58

    On the Windows Subsystem for Linux (Ubuntu 18.04.1 LTS "Bionic"), I had to use the export command:

    export REACT_NATIVE_PACKAGER_HOSTNAME=192.168.1.76.

    0 讨论(0)
  • 2020-12-13 09:58

    My problem solved by reinstall expo client on ios simulator.
    I was used expo v37 before but got this problem on v38, the problem was expo client not have expo sdk 38.

    0 讨论(0)
  • 2020-12-13 10:01

    Sharing my experience using EXPO with Cloud 9 and AWS Amplify. Similar with you, the QR code gives exp://localhost:19000

    As the Security Group has been configured to provide public access, I regenerate the QR code to have it accessible from public IP address of exp://X.X.X.X:19000, this can be scanned from IOS devices to EXPO.

    0 讨论(0)
  • 2020-12-13 10:04

    In windows you can use:

    set REACT_NATIVE_PACKAGER_HOSTNAME=192.168.1.59
    

    set is only used for one session. If you always wanna use the same ip after reboot you can use:

    setx /M REACT_NATIVE_PACKAGER_HOSTNAME 192.168.1.59
    
    0 讨论(0)
提交回复
热议问题