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
Assuming you have node-inspector installed on your computer (if not, just type 'npm install -g node-inspector') you just have to run:
node-inspector & node --debug-brk scriptFileName.js
And paste the URI from the command line into a WebKit (Chrome / Safari) browser.
The V8 debugger released as part of the Google Chrome Developer Tools can be used to debug Node.js scripts. A detailed explanation of how this works can be found in the Node.js GitHub wiki.
There is built-in command line debugger client within Node.js. Cloud 9 IDE have also pretty nice (visual) debugger.
There are many possibilities...
Debug support is often implemented using the v8 Debugging Protocol or the newer Chrome Debugging Protocol.
node --prof ./app.js
node --prof-process ./the-generated-log-file
Libraries that output debugging information
Libraries that enhance stack trace information
ab -n 100000 -c 1 http://127.0.0.1:9778/
These use to work but are no longer maintained or no longer applicable to modern node versions.
Theseus is a project by Adobe research which lets you debug your Node.js code in their Open Source editor Brackets. It has some interesting features like real-time code coverage, retroactive inspection, asynchronous call tree.