message `sh "-c" "node server.js"` failed with 1 openshift error

Hello i recently use redhat openshift and i got error when i run "rhc tail -a {application}".

i got error code :

    -


npm ERR! message sh "-c" "node server.js" failed with 1

and my code:

var fs = require('fs');
var db_helper = require("./db_helper.js");
var ipaddr = process.env.OPENSHIFT_INTERNAL_IP;
var port = process.env.OPENSHIFT_INTERNAL_PORT || 8080;
var http = require('http');
http.createServer().listen(port, ipaddr, function(){
console.log('Server started on %s...', Date(Date.now()));
});
var io = require('socket.io').listen(http);



io.sockets.on('connection',  function(client) {
  console.log('Client connected'); 



  client.on('status', function(data) {
    console.log(data);
      db_helper.get_status(data,function(data) {
        io.sockets.emit('populate', data);

      });

  });
  db_helper.get_statusadmin(function(data) {
        io.sockets.emit('adminpopulate', data);

      });
  client.on('statusadmin', function (data) {
    db_helper.get_statusadmin(function(data) {
        io.sockets.emit('adminpopulate', data);

      });
  });

});

How to solve it?

OpenShift uses npm start to initialize node.js applications. This takes advantage of your app's package.json file, allowing you to define your initialization code by updating the "main" attribute.

sh "-c" "node server.js" is what npm start is calling for you. It sounds like your code contains an error.

I'd try running and debugging your app locally before you deploy.