ThomasReggi ThomasReggi - 1 year ago 209
Node.js Question

Output to Chrome console from Node.js

I'm looking for a way to output Node variables directly into the google chrome browser console. The same way a

works on the client side. Something like this for php. This would greatly speed up development.

Answer Source

NodeMonkey is really awesome. (I agree with honzzz)

1. It's VERY, SUPER simple to use:

All you need to do is include this in your node.js file (after installing it with "npm install node-monkey"):

require('node-monkey').start({host: "", port:"50500"});

(If you don't specify host and port, default is host/port pair is : http://

Then go to http://, and open the browser console (Chrome in my case). All console output will be logged there.

2. Starts automatically with your application

You don't have to open another command prompt to start it up

3. You don't have to refresh the browser every time you restart your application

Once you fire it up, you can leave that console open all the time, and do whatever with your node program, and it will re-connect every time you restart it.

(only drawback is that if stop your application for a long time, your console will be polluted with error messages, which you can clear out, of course)


I have switched to node-inspector and I think it's a better choice. Even though the console messages are not output-ed to the Chrome console, it provides a better code inspection using break-points and watches.

It's also easy to use:

After installing it from NPM globally, (npm install -g node-inspector)

1. start debugger in a command prompt using the following:

node-inspector &

2. start your node application in another command prompt with the following:

node --debug yourNodeProgram.js

3. go to in the browser and setup breakpoints, watches, etc just like you would do a front-end application.

The good part is that everytime you restart your node application, you can leave the node-inspector on. After every restart you can just refresh the node-inspector page in the browser.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download