Cloud 9 IDE上的Socket.io – 警告:错误提出:错误:听EACCES

我正在开发Cloud 9 IDE。

这是我收到的错误:

警告:错误提出:错误:听EACCES

我正在使用云端9指定在我的代码中使用listen:process.env.PORT

这是我的代码:

//app.js Socket IO Test var express = require("express"), redis = require('socket.io/node_modules/redis'), io = require('socket.io').listen(app); var app = express(); var redisPort = [CENSORED] , hostname = [CENSORED] , password = [CENSORED] , db = 1; var pub = redis.createClient(redisPort, hostname); var sub = redis.createClient(redisPort, hostname); var store = redis.createClient(redisPort, hostname); pub.auth(password, function(){console.log("adentro! pub")}); sub.auth(password, function(){console.log("adentro! sub")}); store.auth(password, function(){console.log("adentro! store")}); io.configure( function(){ io.enable('browser client minification'); // send minified client io.enable('browser client etag'); // apply etag caching logic based on version number io.enable('browser client gzip'); // gzip the file io.set('log level', 1); // reduce logging io.set('transports', [ // enable all transports (optional if you want flashsocket) 'websocket' , 'flashsocket' , 'htmlfile' , 'xhr-polling' , 'jsonp-polling' ]); var RedisStore = require('socket.io/lib/stores/redis'); io.set('store', new RedisStore({redisPub:pub, redisSub:sub, redisClient:store})); }); app.listen(process.env.PORT); app.get('/', function (req, res) { res.sendfile(__dirname + '/index.html'); }); var buffer = []; io.sockets.on('connection', function(client){ var Room = ""; client.on("setNickAndRoom", function(nick, fn){ fn({msg : "Hello " + nick.nick}); client.join(nick.room); Room = nick.room; client.broadcast.to(Room).json.send({ msg: "Se conecto al room: " + nick.room, nick : nick }); }); client.on('message', function(message, fn){ var msg = message; //{ message: [client.sessionId, message] }; buffer.push(msg); if (buffer.length > 15) buffer.shift(); client.broadcast.to(Room).json.send(msg); fn(msg); }); client.on('disconnect', function(){ client.broadcast.to(Room).json.send({ msg: "Se desconecto"}); }); }); 

我不知道为什么我在使用Cloud 9build议的端口时出现此错误。

提前致谢!

你不想让套接字听之前创buildapp = express()吗?