Issue while starting dfx

I get this error when i start dfx on my mac.

Error: Failed to get frontend address.
Caused by: Failed to get frontend address.
  Failed to find reusable socket address
    Failed to set socket of tcp builder to 127.0.0.1:8080.
      Address already in use (os error 48)
Error: Timed out waiting for replica to become healthy```

It looks like there’s another process listening on port 8080 on your computer. It may be another dfx local replica, that you can stop by running:

dfx stop

Then, you can try restarting the local replica again with the dfx start command.

If this doesn’t fix your issue, you may want to check what other process is listening on that port:

lsof -i 4tcp:8080 -sTCP:LISTEN

and then terminate it using the PID value (if you don’t need that process, of course).

I have restarted my pc multiple times and i still get the same error.

I think i need to add sudo to the command like this:
sudo lsof -i 4tcp:8080 -sTCP:LISTEN

There was an unwanted process running actually, killed it with the
sudo kill $PID

It works now.

1 Like