【问题标题】:Send iOS Push Notifications with Node.js on Openshift在 Openshift 上使用 Node.js 发送 iOS 推送通知
【发布时间】:2015-08-13 14:22:03
【问题描述】:

我正在开发一个网站,它应该向 iOS 设备发送推送通知。我关注this tutorial 发送通知。在我的本地主机 apnagent 上工作正常,但是当我将 git push 它发送到我的 Openshift 云时,我在终端中收到以下错误:

remote: Waiting for application port (8080) become available ...
remote: Application 'apnagent' failed to start (port 8080 not available)
remote: -------------------------
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 55c3344c89f5cf720xxxxxxx (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/55c3344c89f5cf720xxxxxxx/nodejs
remote: #<IO:0x00000000f1c278>
remote: #<IO:0x00000000f1c200>
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed
To ssh://55c3344c89f5cf720xxxxxxx@apnagent-xxxxxxx.rhcloud.com/~/git/apnagent.git/
   bbcf2a3..87exxxx  master -> master

我的 package.json 看起来像这样:

{
  "private": true,
  "name": "apnagent",
  "version": "0.0.0",
  "dependencies": {
    "apnagent": "1.0.x"
  },
  "engines": {
    "node": ">=0.10.22",
    "npm": ">=1.3.14"
  },
  "scripts": {
    "start": "node agent/_header.js"
  },
  "main": "agent/_header.js"
}

我想我应该以某种方式使用process.env.OPENSHIFT_NODEJS_PORT 作为服务器上的端口,或者类似的东西。我敢肯定,我犯了一些配置错误,因为在我的本地机器上一切正常。

【问题讨论】:

标签: ios node.js push-notification openshift apnagent


【解决方案1】:

您检查过服务器上的日志吗? SSH 进入您的应用并使用

less app-root/logs/nodejs.log

然后按 shift+g 查看服务器最近的控制台输出。我的脚本中有一些语法错误,它们导致了类似的错误。

如果这没有帮助,您可以发布您的服务器脚本吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-17
    • 1970-01-01
    • 2013-01-26
    • 1970-01-01
    • 2017-03-26
    • 1970-01-01
    相关资源
    最近更新 更多