I am trying to run node-inspector with an Express 4 App -- I am running this in a Vagrant box but am able to view the pages in the browser without any problems (I have the ports on the vagrant machine available to the host machine).
I fire up the application either with npm start
or node --debug bin/www
and then start the node-debugger bin/www
. I load the inspector in the browser and it hits the initial breakpoint on the first line but performing any action on the page to debug that would trigger a breakpoint causes an EADDRINUSE
(aka the port is in use) error. I'm a little baffled as to what could be causing this, however, it's very possible I'm using commands that would work on Express 3 instead of 4. Additionally, maybe there is some configuration I am missing to run the debugger on the browser of the host-machine but running inspector on the vagrant box?
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 processnode --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:
node --debug ./bin/www
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>
node-inspector
in the foreground. Make sure you see the normal output and no errors.http://localhost:8080/debug?port=5858
(unless your vagrant IP/port are different)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?If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With