gpt4 book ai didi

node.js - GeddyJs(NodeJs 框架)部署到 heroku cedar 堆栈崩溃

转载 作者:太空宇宙 更新时间:2023-11-03 23:45:03 25 4
gpt4 key购买 nike

我有一个 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"
}
}

最佳答案

我明白了。

编辑config/development.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

删除 .gitignore 文件中的 config\secrets.json 行 - 注意:这在公共(public)存储库上是不安全的,因为它会暴露 cookie 的 secret 哈希值。

关于node.js - GeddyJs(NodeJs 框架)部署到 heroku cedar 堆栈崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14867708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com