How could others, on a local network, access my NodeJS app while it's running on my machine?

后端 未结 15 1690
旧时难觅i
旧时难觅i 2020-12-02 07:55

I have a pretty straight-forward question. I made a web game with NodeJS, and I can successfully play it by myself with multiple browser windows open side-by-side; however,

15条回答
  •  日久生厌
    2020-12-02 08:11

    I had the same question and solved the problem. In my case, the Windows Firewall (not the router) was blocking the V8 machine I/O on the hosting machine.

    1. Go to windows button
    2. Search "Firewall"
    3. Choose "Allow programs to communicate through Firewall"
    4. Click Change Setup
    5. Tick all of "Evented I/O for V8 Javascript" OR "Node.js: Server-side Javascript"

    My guess is that "Evented I/O for V8 Javascript" is the I/O process that node.js communicates to outside world and we need to free it before it can send packets outside of the local computer. After enabling this program to communicate over Windows firewall, I could use any port numbers to listen.

提交回复
热议问题