我有以下代码
var express = require('express')
, app = express()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server)
, connect = require('connect')
, pg = require('pg')
, Client = pg.Client;
// Setup express middleware
app.use(express.static('public'));
app.use(connect.logger());
// Start the server
var port = process.env.OPENSHIFT_INTERNAL_PORT || 8080
, ip = process.env.OPENSHIFT_INTERNAL_IP || "127.0.0.1";
server.listen(port, ip);
但是当应用程序自动启动或我使用节点手动启动它时,我总是收到错误消息:“警告:引发错误:错误:监听 EACCES”
package.json 的内容:
{
"name" : "test-app",
"version" : "0.0.1-1-alpha",
"description" : "test-app",
"dependencies": {
"express" : "3.1.x",
"connect" : "*",
"socket.io" : "0.9.x",
"i18next" : "1.6.x",
"bower" : "1.1.1",
"pg" : "*"
},
"engines": {
"node" : ">=0.10",
"npm" : "1.3.x"
},
"scripts": {
"start" : "node app"
}
}
我能做些什么来解决这个问题?openshift 的示例 server.js 没有这个问题,但它使用 express 2.x。