How do I see Node.js errors?
I'm new to Node.js. I know there are more involved debuggers available (like node_debug and ndb), but is there a simple way to see runtime errors thrown in Node.js?
With a simple example file like this:
var sys = require('sys'),
http = require("http");
var server = http.createServer(function(req, res) {
var foo = [1, 2, 3];
foo.append(4);
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('Ok', 'utf-8');
res.end();
});
server.listen(8080);
sys.puts("Server running at http://localhost:8080/");
the foo.append(4);
line fails, but that err开发者_C百科or doesn't ever seem to get propagated to the console, and I don't see it in Console.app or STD_ERR either.
Is there a way to view that error?
Updating my copy of Node.js (from v0.1.95 to v0.1.99) seems to have fixed it.
精彩评论