Doing some node development on windows. Node programs like to kick out URLs that look like In Linux (iirc) pasting that url into the browser will be successful. But in Windows, it's a 404. I thought I'd just be able to add: localhost

to my hosts file but that doesn't seem to work. For instance, I have a debugger running on http://localhost:8080/debug?port=5858. Works fine. But when I add the above line to my hosts file and try to access I get:

Error 108 (net::ERR_ADDRESS_INVALID): Unknown error.

Node-inspector is a good example:

$ node-inspector                                                      
   info  - socket.io started                                          
visit to start debugging  

Do I just need to manually edit that IP to be equal to localhost when copy/pasting? Or is this a weird difference between Linux and Windows?

How do I get to be equivalent to localhost when browsing urls in Windows 7? Chrome is my 'default' browser.


So, what's happening here is that node is binding to - netspeak for "All interfaces". This includes localhost, any real interfaces you have, and any virtual interfaces you have. It in and of itself generally does not point to an individual interface. (Technically, it points to "This host on this network", but that's ambiguous at best because "this network" is not defined. So is usually understood to point represent the local computer's IP on every network)

Do you need to manually edit that IP when copy/pasting? Yes. If Linux or a specific browser on linux happens to silently correct it to awesome. But as you've found out, that's not a universal thing.

  • Blech, I figured the answer was "that's just windows" but was hoping for better. – jcollum Jan 14 '13 at 20:08
  • converted to http://localhost:8080/debug?port=5858 will work then... – Fiasco Labs Jan 14 '13 at 20:08
  • 1
    It will, but it's a pain to do it everywhere everytime. – Rob Jan 14 '13 at 20:12
  • 2
    FiascoLabs If you read the original question, it does. @jcollum I would actually use that same sentiment towards linux here - It's supporting obscure, ambiguous usecases which only serve to limit interoperability, and I would further blame node.js for not properly cleaning up the URL before printing it out. – Darth Android Jan 14 '13 at 20:16
  • See KB970313 "The Default Gateway may have been set to on a Windows Vista-based or later OS running Apple’s Bonjour service" support.microsoft.com/en-us/kb/970313 – Jeff Lewis Oct 6 '16 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.