I know how to debug http applications using node-inspector and iisnode. But can I use node-inspector to debug a non http node application, on windows?
I tried:
node debug test.js
It says:
debugger listening on port 5858
But opening http://localhost:5858/
in Chrome does not do anything.
BTW: running node debug test.js
does start the command-line debugger which works. But it's nothing like node-inspector.
To use node-inspector, the right switch is node --debug
not node debug
Here are the detailed steps:
npm install -g node-inspector
)node-inspector
http://localhost:8080/debug?port=5858
. You'll get the node-inspector UI but without any running app.--debug
switch like this: node --debug test.js
A few interesting points:
node --debug-brk test.js
Some links which might help you:
It says: debugger listening on port 5858
I wondered myself about this but since the Node.js documentation indicates that the debugger is accessible via a simple TCP protocol and says nothing about HTTP my guess is that no, it won't be available at _http://localhost:5858.
"V8 comes with an extensive debugger which is accessible out-of-process via a simple TCP protocol" - http://nodejs.org/api/debugger.html
Very recently Microsoft released the node.js tools for Visual Studio. It has the very comfortable Visual Studio debugging for node.js.
node-inspector could be very helpful.
Use it from any browser supporting websockets.
Breakpoints, profiler, livecoding, etc..
http://erickrdch.com/2012/09/debug-a-nodejs-app-with-chrome-dev-tools.html
FYI, in OSX 10.8, Chrome v26 doesn't seem to work, but Safari 6 does using the same instructions as above and using 0.0.0.0:8080 to conect.
There is another post by Danny Coates somewhere that says to do it in the following order: