Node.js server crashing without error message

A good start would be to setup, especially in production, before setting the listener for your server, an handler for the exceptions that logs the details. Look at here:

process.on('uncaughtException', function (exception) {
  console.log(exception); // to see your exception details in the console
  // if you are on production, maybe you can send the exception details to your
  // email as well ?
});

If you are using Express.js, take a look at here to know how to see the full stack of your error (and eventually, again, send it to your email if you are on production).
In that case, tell it to give you the full details before instantiating the listener:

var express = require('express');
// ...
var app = express();
var errorHandler = require('errorhandler')

// ...
app.use(errorHandler({ dumpExceptions: true, showStack: true })); 
// then, set the listener and do your stuff...

2019 update: you’ll need to install the errorHandler package

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)