How do I debug a Node.js server application?
Right now I\'m mostly using alert debugging with print statements like this:
sys.puts(sys.inspe
A quick-and-dirty way to debug small Node.js scripts with your favorite browser debugger would be to use browserify. Note that this approach doesn't work with any applications which require native I/O libraries, but it is good enough for most small scripts.
$ npm install -g browserify
Now move all your var x = requires('x') calls into a requires.js file and run:
$ browserify requires.js -s window -o bundle.js
(The downside here is that you either have to move or comment the requires in all your files.)
Include the bundle.js in an HTML file like so:
Now load the file in your browser and press F12 and viola: debug in browser.