Next.js Discord

Discord Forum

Trouble Accessing Localhost Development Server from Windows to Mac

Answered
Havana posted this in #help-forum
Open in Discord
HavanaOP
Hello everyone,

I'm encountering an issue while trying to access a development server hosted on my Windows machine from my Mac. Here's the setup:

- Windows machine: Running npm run dev with the development server on http://localhost:3000.
- Mac machine: Attempting to access the development server using the IP address of the Windows machine (e.g., http://192.168.1.47:3000).

The problem arises when I try to access the development server from my Mac using the IP address of the Windows machine. The connection seems to hang for a while and eventually times out.

I've tried troubleshooting by:

1. Verifying that both machines are connected to the same LAN (Local Area Network).
2. Checking the IP addresses of both machines to ensure they are on the same subnet.

However, despite these checks, I'm still unable to access the development server from my Mac.

Could this issue be related to Windows using LAN and the Mac being unable to communicate with it properly? Or are there other network configurations I should consider?

Any insights or suggestions on how to resolve this issue would be greatly appreciated. Thank you
Answered by Havana
The issue was with the firewall. Setting my network to private and allowing Node.js runtime would fix it.
View full answer

33 Replies

See the -H flag
if you cant get it working
This is a free tool you can use
to make your local server tempoarily available via the internet
it's useful for these sort of situations
HavanaOP
no
Dwarf Hotot
Maybe give that a shot
The fact that the connection hangs for a bit is weird
(If you want, I can try recreating this. I happen to have a very similar setup)
HavanaOP
This is the ping result from Windows (192.168.1.47) to Mac (192.168.1.225):

>ping 192.168.1.225

Pinging 192.168.1.225 with 32 bytes of data:
Reply from 192.168.1.225: bytes=32 time=4ms TTL=64
Reply from 192.168.1.225: bytes=32 time=3ms TTL=64
Reply from 192.168.1.225: bytes=32 time=5ms TTL=64
Reply from 192.168.1.225: bytes=32 time=4ms TTL=64

Ping statistics for 192.168.1.225:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milliseconds:
    Minimum = 3ms, Maximum = 5ms, Average = 4ms


Pinging from Mac to Windows is still ongoing and has reached the 300th ping.
Dwarf Hotot
Hm, so they can see each other
HavanaOP
I've tried this already, and it's still the same.
Dwarf Hotot
Dang
HavanaOP
It's strange that hosting from my Mac and accessing it from Windows is working fine.
Did you try the -H flag?
HavanaOP
no, will try it
HavanaOP
Didn't work
I've set the -H to the same IP address. Not sure if that's causing any issues.
also keep in mind, worst case scenario just use ngrok
im assuming you just want to see what your app looks like on a differnt os
vs actively developing across the network?
HavanaOP
Exactly
ngrok http http://localhost:3000
and you'll get a url in return
which can be accessed via the internet
HavanaOP
Sorry, I meant to develop actively across the network, not just view.
@linesofcode `ngrok http http://localhost:3000`
HavanaOP
I believe the Vercel CLI can do that.
HavanaOP
The issue was with the firewall. Setting my network to private and allowing Node.js runtime would fix it.
Answer