应用程序'appname'无法启动(端口8080不可用)打开移位节点应用程序 [英] Application 'appname' failed to start (port 8080 not available) on open shift node app

查看:627
本文介绍了应用程序'appname'无法启动(端口8080不可用)打开移位节点应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在咖啡中写了一个节点restify服务器,我似乎无法让它运行。

I have written a node restify server in coffee and I can't seem to get it running.

部署时收到以下错误:


正在等待应用程式端口(8080)可用...

Waiting for application port (8080) become available ...

之后会收到以下错误


应用程式'appname'无法启动(8080端口不可用)

Application 'appname' failed to start (port 8080 not available)

如果coffeescript似乎是问题是有一个工作。我不想改回js。

If coffeescript seems to be the problem is there a work around it. I would not want to change back to js.

我的服务器代码是:

restify = require 'restify'
Bunyan = require 'bunyan'

server = restify.createServer
    name: 'APPNAME'
    version: '0.0.1'
    log: Bunyan.createLogger
        name: 'api'
        serializers: 
            req: ()->
                return "bad"

# Usercontroller.access calls a function to process the request
server.post '/user/access', UserController.access

server = create.createServer()
server.listen server_port, ->
    console.log "Http server listening on #{server_port}"
    require('./document')(server.router.mounts, 'restify')
    return


推荐答案

您需要检查的第一步是查看日志下〜 /app-root/logs/nodejs.log

The very first step that you need to check is look at the log under ~/app-root/logs/nodejs.log

在我的情况下,软件包或任何类型的访问都没有问题。我在日志中得到的唯一信息是:

In my case there was no issue with package or any kind of access. The only information that I have got in log is:


错误:侦听 EACCES at errnoException :905:11)at
Server._listen2(net.js:1024:19)

Error: listen EACCES at errnoException (net.js:905:11) at Server._listen2 (net.js:1024:19)

原因除了前面的控制台说,它是无法访问8080,然后确保您指定IP地址与端口号。

If you cannot find any reason apart from the front console says that it is unable to access 8080 then make sure that you have specified IP ADDRESS along with PORT Number.

这是我如何修复它。

var express = require('express');
var app = express();
var http = require('http');

app.set('port', process.env.OPENSHIFT_NODEJS_PORT || process.env.PORT || 3002);
app.set('ip', process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1");


http.createServer(app).listen(app.get('port') ,app.get('ip'), function () {
    console.log("✔ Express server listening at %s:%d ", app.get('ip'),app.get('port'));
    server();
});




如上所述,app.get('ip')非常重要当听时。否则,openshift无法启动您的应用程序。

As stated the app.get('ip') is very important when listening. Otherwise, openshift is unable to start your application.

UPDATED:

如何进入日志目录:


  1. 使用命令rhc ssh进入您的设备

  2. 一次您已登录类型 cd $ OPENSHIFT_LOG_DIR

  1. SSH into your gear with the command rhc ssh
  2. Once you are logged in type cd $OPENSHIFT_LOG_DIR

通过Openshift环境。

There you have logs files stored by Openshift environment.

这篇关于应用程序'appname'无法启动(端口8080不可用)打开移位节点应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆