question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught Error: Packeger is not running at {host_ip}

See original GitHub issue

// host_ip = 192.168.0.141 // wsl_ip = 172.17.132.182 //phone_ip = 192.168.0.64

Actually I am able to run my expo application without problems when using Ubuntu 18.04 through WSL 1. After Microsoft released the version 20.04, I decided to give it a try to use WSL 2 and run my application from there, but since network approach that WSL 2 uses is different from WSL 1, I am not able to access the application (this is my honest guest).

I had tried the following troubleshooting, but none of them had worked so far:

Disable Firewall on Windows 10 and Ubuntu 18.04 (through WSL 2).

  1. Make sure that my phone is connected to the same network of the host machine, and that I can ping the host machine from WSL2 ( I have to mention that before disabling the firewall I was not able to ping the host machine).

  2. Once I run expo start the project starts without problems at {wsl_ip}, however, I get the following response:

Uncaught Error: java.net.SocketTimeoutException: failed to connect to /172.17.132.182(port 19000) from /192.168.0.64 (port 43609) after 10000ms

After noticing that the project should be running in the localhost (host_ip) address I try the next step:

  1. Changing environment variable REACT_NATIVE_PACKAGER_HOSTNAME on WSL2 to 127.0.0.1, but I get as a response:

Uncaught Error: java.net.ConnectException: Failed to connect to http://127.0.0.1:19000

Since it was not able to connect I change the environment variable to the {host_ip} as follows:

  1. Changing REACT_NATIVE_PACKAGER_HOSTNAME to 192.168.0.141, but I get as a response:

Uncaught Error: Packeger is not running at http://192.168.0.141:19001

I have tried everything I saw on the issue #1381, but none of then had worked. Do you have anything else in mind that I should try?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
darynmitchellcommented, Dec 14, 2020

I needed the same and ran into same issues.

Here’s the full of what I found worked for LAN development between my mobile and expo running in WSL2:

1. One time at the start: open Expo ports inbound in Windows Firewall

Windows firewall should be on, and it should block inbound attempts by default. The following will open the Expo ports 19000–19006, inbound, but only on a network that you have configured as “private” (that’s the -Profile Private part): (powershell)

New-NetFireWallRule -Profile Private -DisplayName 'Expo ports for LAN development' `
    -Direction Inbound -LocalPort 19000-19006 -Action Allow -Protocol TCP

(You can check it after with Get-NetFirewallRule |Where-Object {$_.DisplayName -Match "Expo.*"})

2. Point portproxy to WSL; Re-run “Each time WSL has a new IP address”

(I’m not sure yet how often the WSL IP address changes, but I suspect only a reboot would)

I saw stuff on the web saying portproxy to connectaddress=127.0.0.1 but it did not work for me (WSL2, Windows 10 20H2).

So here’s a reusable command to auto set the connectaddress to the right WSL address: (powershell, just for the easy inline Trim())

netsh interface portproxy add v4tov4 listenport=19000 listenaddress=0.0.0.0 `
    connectport=19000 connectaddress=$($(wsl hostname -I).Trim());

netsh interface portproxy add v4tov4 listenport=19001 listenaddress=0.0.0.0 `
    connectport=19001 connectaddress=$($(wsl hostname -I).Trim());

3. Point Metro to your dev machine LAN IP Address; Re-run inside WSL “Each time dev host has a new IP address”

This is the one that probably changes most often. Your laptop local network IP certainly changes when you change networks (e.g. home/office) — and can change at other times too.

Fortunately it’s also pastable / aliasable: WSL2 shell

export REACT_NATIVE_PACKAGER_HOSTNAME=$(netsh.exe interface ip show address "Wi-Fi" | grep 'IP Address' | sed -r 's/^.*IP Address:\W*//')

echo Meteor will use dev machine IP address: $REACT_NATIVE_PACKAGER_HOSTNAME

(If your dev box doesn’t change LAN often, you might get away with setting REACT_NATIVE_PACKAGER_HOSTNAME in your .bashrc / .zshrc)


I “wish I didn’t have to re-run things and it could all be automated”,
but that same laziness makes me happy to have commands 2 and 3 able to simple “rerun” and consistently get Expo LAN mode working for my WSL2-hosted Expo dev mode.

1reaction
byCedriccommented, Apr 27, 2020

Hi @franciscosuca! I’m running WSL too, but I haven’t figured out the fix for this issue. Basically what happens is, your WSL container gets a custom IP that is ported/tunneled to your host (Windows) environment. This works fine if you use the tools on Windows itself, e.g. an Android virtual device. But not so much for any other device unfortunately 😢

A workaround that I often use for computers where I can’t access the IP directly (e.g. WSL or remote server) is switching to tunnels. With this, you should be able to connect to your WSL running bundler from your phone 😄

Hope it helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught error: packager is not running at localhost: 19001 ...
I can run Expo locally through the cli or XDE and open the project in the simulator, but trying to open on the...
Read more >
Packager is not running at http://192.168.0.100.19001 - Stack ...
I found that this error message could arise for a very simple reason, make sure your smartphone running Expo is connected to the...
Read more >
Work around the "Could not determine host ip address" error ...
For some reasons, I got this error when running the stack.sh script ... [ERROR] /opt/stack/devstack/stackrc:759 Could not determine host ip ...
Read more >
Fix Host 'IP' is blocked because of many connection errors on ...
I am trying to login to my mysql/mysqld server using the following Unix command: $ mysql -u foo -h 172.16.5.100 -p dbnmame
Read more >
Error: couldn't connect to server 127.0.0.1:27017 - MongoDB
A MongoDB server is not listening on the requested Host/IP and port (check they are both correct); You are connecting to a remote...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found