Question

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.)

Was it helpful?

Solution

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.

OTHER TIPS

Agh. Okay, looked at some more questions before I got this posted. Looks like the problem was just that I wasn't running the original instance in debug mode. Nobody had told me I had to, so I just didn't know otherwise!

What's working for me now:

> node debug web

then in a different terminal

> node-debug web.js
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top