Heroku Node.js - 权限被拒绝

时间:2013-02-01 04:36:05

标签: node.js heroku socket.io node.js-connect

我正在尝试将一个简单的应用程序部署到Heroku,它使用模块'socket.io'和'connect'。当我部署应用程序时,我得到一个Permission Denied错误,应用程序崩溃了。我从环境属性'PORT'获取端口号。我正在配置socket.io以使用长轮询而不是WebSockets(因为我知道它们不受支持)。

有人能告诉我我做错了吗?

     var io = require('socket.io'),
        connect = require('connect');

    var port = process.env.PORT || 5000;


    var app = connect().use(connect.static('public')).listen(port);
    var chat_room = io.listen(app);


    chat_room.configure(function () {
        chat_room.set("transports", ["xhr-polling"]);
        chat_room.set("polling duration", 10);
    });

chat_room.sockets.on('connection', function(socket){
    socket.emit('entrance', {message:'Welcome to the chat room.'});
    socket.on('disconnect', function(){
         chat_room.sockets.emit('exit', {message:'A chatter has disconnected.'});
     });

     socket.on('chat', function(data){
        chat_room.sockets.emit('chat',{message: '# ' + data.message});
     });
     chat_room.sockets.emit('entrance', {message: 'A new chatter is online.'});
 });

以下是日志中的错误:

2013-02-01T04:24:04+00:00 app[web.1]: Error: EACCES, Permission denied
2013-02-01T04:24:04+00:00 app[web.1]:     at Server.listen (net.js:1063:20)
2013-02-01T04:24:04+00:00 app[web.1]: node.js:134
2013-02-01T04:24:04+00:00 app[web.1]:     at Server._doListen (net.js:1098:5)
2013-02-01T04:24:04+00:00 app[web.1]:     at net.js:1069:14
2013-02-01T04:24:04+00:00 app[web.1]:     at Object.lookup (dns.js:153:45)
2013-02-01T04:24:04+00:00 app[web.1]:     at Object.listen (/app/node_modules/socket.io/lib/socket.io.js:67:12)
2013-02-01T04:24:04+00:00 app[web.1]:     at Object.<anonymous> (/app/main.js:8:20)
2013-02-01T04:24:04+00:00 app[web.1]:     at Module.load (module.js:336:31)
2013-02-01T04:24:04+00:00 app[web.1]:     at Module._compile (module.js:404:26)
2013-02-01T04:24:04+00:00 app[web.1]:     at Function._load (module.js:297:12)
2013-02-01T04:24:04+00:00 app[web.1]:     at Object..js (module.js:410:10)
2013-02-01T04:24:06+00:00 heroku[web.1]: Process exited with status 1
2013-02-01T04:24:06+00:00 heroku[web.1]: State changed from starting to crashed

谢谢!

0 个答案:

没有答案