Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xx745/a35d11f6a7da4ad8cae4c9aa53d243a6 to your computer and use it in GitHub Desktop.
Save xx745/a35d11f6a7da4ad8cae4c9aa53d243a6 to your computer and use it in GitHub Desktop.
Running React Native Expo Go app throught Windows WSL2 and Ubuntu
  1. Initialize React Native project in your WSL2 Linux with:
npx create-expo-app <PROJECT_NAME_HERE>

Simply follow official docs "Expo Go Quickstart": https://reactnative.dev/docs/environment-setup

  1. Allow inbound and outbound traffic in your Windows Firewall on port 19000.

  2. In PowerShell terminal of your WSL2 user find IP address:

bash.exe -c "ifconfig eth0 | grep 'inet '"
  1. Run new PowerShell terminal window as admin :
Start-Process powershell -verb runas
  1. Set up port forwarding using <WSL2_IP_ADDRESS> from pt. 3
netsh interface portproxy add v4tov4 listenport=19000 listenaddress=0.0.0.0 connectport=19000 connectaddress=<WSL2_IP_ADDRESS>
  1. In the WSL2 Linux terminal set up your Windows host's IP for Metro which will run your app:
export REACT_NATIVE_PACKAGER_HOSTNAME=$(netsh.exe interface ip show address "Wi-Fi" | grep 'IP Address' | sed -r 's/^.*IP Address:\W*//')
  1. In the WSL2 Linux terminal run run app with:
npm start
  1. Using provided QR code load app on your phone through Expo Go app.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment