无法让节点应用程序在openshift上运行,错误:侦听EACCES

我一直在努力修复这个好几个小时,用无尽的谷歌search,我尝试启动应用程序,去url,看到503服务不可用的错误,然后我cd到app-root / repo,尝试手动启动server.js ,并得到以下内容:

[my-app-url.rhcloud.com repo]\> node server.js { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version Connecting to server events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:901:11) at Server._listen2 (net.js:1039:14) at listen (net.js:1061:10) at net.js:1143:9 at dns.js:72:18 at process._tickCallback (node.js:415:13) at Function.Module.runMain (module.js:499:11) at startup (node.js:119:16) at node.js:902:3 

这让我疯狂,我试图做的只是一个简单的API,它在我的本地环境中完美的工作。

谢谢。

       

网上收集的解决方案 "无法让节点应用程序在openshift上运行,错误:侦听EACCES"

此程序的另一个程序或实例正在同一端口上运行。

运行 – sudo netstat -tapen | grep ":<<your given port>>" sudo netstat -tapen | grep ":<<your given port>>"

然后杀死进程。

然后尝试运行服务器…

谢谢

你需要绑定到OPENSHIFT_NODEJS_IP,我看到你只绑定到正确的端口,而不是ip: https : //developers.openshift.com/en/node-js-getting-started.html

https://github.com/openshift-quickstart/openshift-nodejs-http-and-websocket-example/blob/master/server.js#L1

 var ipaddress = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1"; var port = process.env.OPENSHIFT_NODEJS_PORT || 8080; var WebSocketServer = require('ws').Server var http = require('http'); var server = http.createServer(function(request, response) { console.log((new Date()) + ' Received request for ' + request.url); response.writeHead(200, {'Content-Type': 'text/plain'}); response.write("Welcome to Node.js on OpenShift!\n\n"); response.end("Thanks for visiting us! \n"); }); server.listen( port, ipaddress, function() { console.log((new Date()) + ' Server is listening on port 8080'); }); wss = new WebSocketServer({ server: server, autoAcceptConnections: false }); wss.on('connection', function(ws) { console.log("New connection"); ws.on('message', function(message) { ws.send("Received: " + message); }); ws.send('Welcome!'); }); console.log("Listening to " + ipaddress + ":" + port + "...");