Node.js EADDRNOTAVAIL wrong IP address -SOLVED



According to docs

Cloud9 hosted workspaces now allow workspaces to listen on multiple ports. The following ports are supported (along with the urls they can be accessed from):

8080 ->
8081 ->
8082 ->

My app is configured to use port 8081

When I run the app, error shows a wrongly assigned IP address (different each time) instead of 0.0.0.

Watching for changes
ready to watch file changes
Starting Server
webserver available at

      throw er; // Unhandled 'error' event

Error: listen EADDRNOTAVAIL ****:8081
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at Server._listen2 (net.js:1246:19)
    at listen (net.js:1295:10)
    at net.js:1405:9
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10)

How do I configure port 8081 to resolve to


Which host you use use for creating the server? From the output it seems to be You need to use instead since is the public address of the proxy. Or modify your /etc/hosts file echo " $C9_HOSTNAME" | sudo tee -a /etc/hosts


When I open /etc/hosts       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Bear with me, as I don’t understand your answer 100%. I’m trying to understand why I get the error. Note the dynamic IP address in the output: or should the IP address be with as my public address?

My app framework webserver json was:

          "enabled": true,
          "host": "localhost",
          "port": 8081

I changed it to

          "enabled": true,
          "host": "",
          "port": 8081

Which resulted in the error and output in my post. What should localhost be ?


host should be changed to, is the public address of the proxy, 8081 is not a part of the host


Ok thanks, that worked for me

      "host": "",
      "port": 8081


However I have a similar problem in next steps:
to resolve “localhost” in framework json …If you could tell me what these are doing