Node-inspector with Express 4 Node-inspector with Express 4 express express

Node-inspector with Express 4


Update: I'm pretty sure this is your problem:

node --debug bin/www and then start the node-debugger bin/www.

Don't do BOTH of those. It's one or the other. They are 2 ways of doing the same thing. I prefer the former way as it's simpler and works with node itself whether or not you are using node-inspector.

To summarize:

  • node-debug bin/www starts both your app in debug mode AND node-inspector in the same process
  • node --debug bin/www starts your app in debug mode. This should be combined with a separate terminal window where you run node-inspector as a separate process. I recommend this approach, but either should work.

Here's my suggestion to start troubleshooting this. Try to use the simplest form of the commands to get everything running:

  • in one ssh session terminal inside your vagrant host, start your app directly in the foreground with node --debug ./bin/www
    • v8 will try to bind to port 5858. You should see this message "debugger listening on port 5858" and NOT this message "Failed to open socket on port 5858, waiting 1000 ms before retrying"
    • If you see the "Failed to open socket on port 5858" message, there's another process already listening. run sudo netstat -ntlp to see which process it is, comprehend what it is and why it is running, and then kill it to free up the port kill <pid-you-got-from-netstat>
  • In a separate ssh session terminal inside your vagrant host, start the node-inspector web server node-inspector in the foreground. Make sure you see the normal output and no errors.
  • Now connect to the right URL which is probably something like http://localhost:8080/debug?port=5858 (unless your vagrant IP/port are different)
  • if you get there and resolve any unexpected errors you see along the way, things really should work, but if not post some exact details about this EADDRINUSE error you see. Is that an exception within your app itself? If so, is there a stale instance of your express app already running somewhere else in your vagrant host and thus bound on your application's web server port?