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.

nx serve does not bind to ip address

See original GitHub issue

Hey guys,

I am developing a React webapp using Nx. I require this app to test on phone. But I cannot access it over wi-fi using the ip address. Is there a way to ensure nx binds to 0.0.0.0 instead of localhost so that I can access it using http://192.168.0.102:4200 ?

This is how netstat looks like

tcp4       0      0  192.168.0.102.63776    104.21.212.16.https    ESTABLISHED
tcp4       0      0  localhost.4200         localhost.63645        ESTABLISHED
tcp4       0      0  localhost.63645        localhost.4200         ESTABLISHED

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

17reactions
Cammisulicommented, Dec 2, 2019

Can you try running this command, and let me know how it goes?

yarn nx serve --host=0.0.0.0
2reactions
achantzcommented, Feb 24, 2022

None of the suggestions are working anymore (at least with nx v13 and next v12), you need to specify the hostname attribute either via a command line:

yarn start app --hostname 0.0.0.0

or via a serve target options:

"serve": {
  "executor": "@nrwl/next:server",
  "options": {
    "buildTarget": "app:build",
    "port": 3000,
    "hostname": "0.0.0.0",
    "dev": true
  },
  "configurations": {
    ...
  }
}

Small correction: “hostname”: “0.0.0.0” should be “host”: “0.0.0.0” to be picked up by the npm start command. See Below:

"serve": {
  "executor": "@nrwl/next:server",
  "options": {
    "buildTarget": "app:build",
    "port": 3000,
    "host": "0.0.0.0",
    "dev": true
  },
  "configurations": {
    ...
  }
}

Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NX node: set bind/connect ip - NoMachine Forums
Hello ponch, NoMachine require associating local IP address 127.0.0.1 with localhost hostname. Please check if you can (temporarily) set the ...
Read more >
How to host NextJS app on 0.0.0.0:3000 with nrwl/next (not ...
I'm using nrwl/nx and NextJS even if the port is correct the host is not. next.js · nrwl-nx · nomachine-nx · Share.
Read more >
Cisco Nexus 9000 Series NX-OS Security Configuration ...
In previous releases, DHCP snooping static binding entries allow only one IP address with the same MAC address and VLAN. VXLAN supports DHCP ......
Read more >
nslookup Failure - domain name system - Server Fault
As part of the IP address assignment, your DHCP client is rewriting ... This "other" DNS server does not know about your domain....
Read more >
K18522641: Overview of the DNS profile (14.x and later) - AskF5
You cannot add a DNS profile to a virtual server that has a ... Disabled: The BIG-IP system does not map IPv4 addresses...
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