Can't get node-debug to work

MalcolmOcean picture MalcolmOcean · May 2, 2014 · Viewed 7k times · Source

This feels really silly, but I can't get node inspector / node-debug to work.

The instructions say to do npm install then to run node-debug web.js. So I did that. Now I have a lovely browser window open showing me my code with breakpoints... and no idea which url to use to actually access the code.

The inspector is at http://localhost:8080/debug?port=5858 and the terminal says:

> node-debug web.js
debugger listening on port 5858
Node Inspector is now available from http://localhost:8080/debug?port=5858
Debugging `web.js`

...

I've tried hitting up localhost:5000 (which is my express.js port) but that either fails if I don't have a separate node web.js instance running, or it succeeds if I have the other one running but doesn't trip any of the breakpoints in the inspector.

When I go to http://localhost:5858/, I get:

Remote debugging session already active

When I go to http://localhost:8080/, I get:

Cannot GET /

(the / path totally works on my server in general.)

Answer

3y3 picture 3y3 · May 3, 2014

By default node-debug starts app in --debug-brk mode. This stops your app at first line (express not started).

You can use node-debug --no-debug-brk see the node-debug --h for more info.