GeddyJs(NodeJs框架)部署到heroku雪松堆栈崩溃

时间:2013-02-14 04:14:40

标签: node.js heroku geddy

我有一个geddyJs应用程序在启动时崩溃..

崩溃日志是:

2013-02-14T04:04:19+00:00 heroku[run.4236]: Starting process with command `geddy -e production`
2013-02-14T04:04:19+00:00 app[web.1]: 
2013-02-14T04:04:19+00:00 app[web.1]: module.js:340
2013-02-14T04:04:19+00:00 app[web.1]:     throw err;
2013-02-14T04:04:19+00:00 app[web.1]:           ^
2013-02-14T04:04:19+00:00 app[web.1]: Error: Cannot find module '/app/config/true'
2013-02-14T04:04:19+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:338:15)
2013-02-14T04:04:19+00:00 app[web.1]:     at Function.Module._load (module.js:280:25)
2013-02-14T04:04:19+00:00 app[web.1]:     at Module.require (module.js:362:17)
2013-02-14T04:04:19+00:00 app[web.1]:     at require (module.js:378:17)
2013-02-14T04:04:19+00:00 app[web.1]:     at config.readConfig (/app/node_modules/geddy/lib/config.js:49:24)
2013-02-14T04:04:19+00:00 app[web.1]:     at _readConfig (/app/node_modules/geddy/lib/cluster/master.js:36:30)
2013-02-14T04:04:19+00:00 app[web.1]:     at async.AsyncBase.runItem (/app/node_modules/geddy/node_modules/utilities/lib/async.js:108:10)
2013-02-14T04:04:19+00:00 app[web.1]:     at async.AsyncBase.next (/app/node_modules/geddy/node_modules/utilities/lib/async.js:113:12)
2013-02-14T04:04:19+00:00 app[web.1]:     at Master.start (/app/node_modules/geddy/lib/cluster/master.js:257:11)
2013-02-14T04:04:19+00:00 app[web.1]:     at Object.utils.mixin.startCluster (/app/node_modules/geddy/lib/geddy.js:64:9)
2013-02-14T04:04:19+00:00 heroku[run.4236]: State changed from starting to up
2013-02-14T04:04:20+00:00 heroku[web.1]: Process exited with status 1
2013-02-14T04:04:20+00:00 heroku[web.1]: State changed from starting to crashed

我的Procfile是:

web: geddy -e $NODE_ENV

我的Package.json文件是:

{
        "name": "new-gorelative",
        "version": "0.0.1",
        "auther": "Mike DeVita <mike@gorelative.com>",
        "dependencies": {
            "geddy": "0.6.x",
            "handlebars": "*"
        },
      "engines": {
        "node": "0.8.x",
        "npm": "1.1.x"
      }
}

2 个答案:

答案 0 :(得分:1)

部署文档已更新,以反映部署到heroku所需的当前步骤(以及其他步骤)。新的更改将/应该在那里更新。

答案 1 :(得分:1)

我明白了。

编辑config/production.js文件并删除/注释以下行(端口,主机名)

var config = {
  //port: '3000',
  // hostname: '0.0.0.0'
};

app.js javascript文件添加到您应用的根目录,此处设置的配置将覆盖production.js

var geddy = require('geddy');

geddy.startCluster({
  hostname: process.env.IP || '127.0.0.1',
  port: process.env.PORT || '3000',
  // you can manually set this to production, or set an environment variable via heroku..
  environment: 'production'
  // just uncomment the below line, and delete the above line.
  // you will need to set an environment variable in heroku by running
  // heroku config:set NODE_ENV=production
  //environment: process.env.NODE_ENV || 'development'
});

Procfile文本文件添加到应用的根目录

web: node app.js

删除config\secrets.json文件中.gitignore的行 - 注意:这是不安全的,因为它暴露了您的Cookie的秘密哈希。