Error when try to run server.js


#1

I Start a new Nodejs Worskspace and change my server.js to this:

//
// # SimpleServer
//
// A simple chat server using Socket.IO, Express, and Async.
//
var http = require('http');
var path = require('path');

var async = require('async');
var socketio = require('socket.io');
var express = require('express');

//
// ## SimpleServer `SimpleServer(obj)`
//
// Creates a new instance of SimpleServer with the following options:
//  * `port` - The HTTP port to listen on. If `process.env.PORT` is set, _it overrides this value_.
//
var router = express();
var server = http.createServer(router);
var io = socketio.listen(server);

router.use(express.static(path.resolve(__dirname, 'client')));
var messages = [];
var sockets = [];


router.get('/webhook', function(req,res){
  res.send('ok');
});
server.listen(process.env.PORT || 3000, process.env.IP || "0.0.0.0", function(){
  var addr = server.address();
  console.log("Chat server listening at", addr.address + ":" + addr.port);
});

so when I try to run clicking in RUN BUTTON I got the message:

Your code is running at https://chefbot-fabioebner.c9users.io.
Important: use process.env.PORT as the port and process.env.IP as the host in your scripts!

(node:4849) [DEP0062] DeprecationWarning: node --debug and node --debug-brk are invalid. Please use node --inspect or node --inspect-brk instead.

Process exited with code: 9

But my app don`t start.

I need to go to console and run node server.js anyone know why?

tks


#2

This is an issue we’re having right now with the newest version of Node.js that we’ve uploaded, where the debugger isn’t working with our current runner. If you’re using the Run button, deactivate the debugger by clicking the bug icon next to the “Command” box. Alternately, you can run this through the terminal directly.


#3

nice. works.

Can I disable this by default?