Use Chrome or Safari to Debug your Node.js codes

1. Install node-inspector

npm install node-inspector

2. Start up node-inspector


>visit to start debugging

3. Start up node

node –debug test.js

>debugger listening on port 5858 >Server running at

4. Open URL: in Chrome or Safari, Open Inspector in your browser, select the test.js file

5. Add a breakpoint in the test.js file

6. Open URL:

You should see what you want.

test.js file:

var http = require('http');

var x = 0;
http.createServer(function (req, res) {
  x += 1;
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World ' + x);
console.log('Server running at');


Comments are closed.