chrismanderson chrismanderson - 4 months ago 49
Node.js Question

Node.js console.log() not logging anything

Trying out node.js for the first time. Set up node, set up the example app from the site. Can start the server fine, but

isn't actually logging anything. Tried the Javascript console in Chrome, Firefox, and Safari - nothing appears in the log. Also checked Console on my Mac just for kicks, nothing was there either. What am I missing?

(Here's the example code that works but doesn't log anything.)

var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "");
console.log('Server running at');


In a node.js server console.log outputs to the terminal window, not to the browser.

How are you running your server? You should see the output directly after you start it.