centos上的node.js + express.io,没有错误的bash命令,没有反馈

时间:2015-12-05 09:23:46

标签: linux node.js bash centos express.io

我的 nodeJs 脚本(/usr/bin/nodeapps/my/index.js):

app = require('express.io')();
app.http().io();
console.log("Ready!");

app.io.sockets.on('connection', function(s) {
    console.log("Utente connesso!");
    s.on('disconnect', function() {
        console.log('Utente disconnesso!');
    });
});


app.io.route('msg', function(req) {
    console.log(req.data.messaggio);
    app.io.sockets.emit('res', {
        data: req.data.messaggio
    });

});


app.get('/', function(req, res) {
    res.sendfile('index.html')
});

app.get('/s', function(req, res) {
    res.sendfile('s.html')
});

app.listen(9000);

依赖关系(/usr/bin/nodeapps/my/package.json):

{
  "name": "socket-chat-example",
  "version": "0.0.1",
  "description": "my first socket.io app",
  "dependencies": {
      "coffee-script": "*",
      "express.io": "*",
      "connect": "*"
   }
}

节点版本(node --version):

v5.0.0

问题:
我跑的时候:

node index.js

或:

node index

bash运行,但express.io服务器无法启动。 只有 console.log(" Ready!");

Ready!

并在1秒后脚本停止,终端显示一行没有任何错误。

在Windows中

一切正常,服务器启动并等待连接。

0 个答案:

没有答案