2016-10-17 10 views
0

私は英雄でアプリケーションを手動でデプロイしました(以前は実行しておらず、githubリポジトリに接続していました)。これは、正常にデプロイが、Imはエラーを取得してこう述べています。heroku nodejs appのデプロイ - アプリケーションでエラーが発生し、ページを処理できませんでした。しばらくしてからもう一度お試しください。

An error occurred in the application and your page could not be served. Please 
try again in a few moments. 
If you are the application owner, check your logs for details. 

私のログは、次のとおりです。

2016-10-17T02:39:38.026918+00:00 app[web.1]:  at Function.Module._load (module.js:314:12) 
2016-10-17T02:39:38.026919+00:00 app[web.1]:  at Module.require (module.js:367:17) 
2016-10-17T02:39:38.026919+00:00 app[web.1]:  at require (internal/module.js:20:19) 
2016-10-17T02:39:38.026920+00:00 app[web.1]:  at Object.<anonymous> (/app/server/db/index.js:2:10) 
2016-10-17T02:39:38.026921+00:00 app[web.1]:  at Module._compile (module.js:413:34) 
2016-10-17T02:39:38.026921+00:00 app[web.1]:  at loader (/app/node_modules/babel-register/lib/node.js:144:5) 
2016-10-17T02:39:38.026922+00:00 app[web.1]:  at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:154:7) 
2016-10-17T02:39:38.026923+00:00 app[web.1]:  at Module.load (module.js:357:32) 
2016-10-17T02:39:38.116826+00:00 heroku[web.1]: State changed from starting to crashed 
2016-10-17T02:39:38.917261+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pokemartapp.herokuapp.com request_id=90de2bee-e747-4901-8554-90aa3d57c1f1 fwd="68.105.253.103" dyno= connect= service= status=503 bytes= 
2016-10-17T02:43:14.022540+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pokemartapp.herokuapp.com request_id=589b8bf6-e786-43d6-b6e8-d9b09dca7586 fwd="68.105.253.103" dyno= connect= service= status=503 bytes= 

マイサーバー:

var chalk = require('chalk'); 
var db = require('./db'); 
var server = require('http').createServer(); 

var createApplication = function() { 
    var app = require('./app')(db); 
    server.on('request', app); // Attach the Express application. 
    require('./io')(server); // Attach socket.io. 
}; 

var startServer = function() { 
    var PORT = process.env.PORT || 1337; 

    server.listen(PORT, function() { 
     console.log(chalk.blue('Server started on port', chalk.magenta(PORT))); 
    }); 
}; 

db.sync().then(createApplication).then(startServer).catch(function (err) { 
    console.error(chalk.red(err.stack)); 
}); 

マイprocfile:

web: node server/start.js 

サーバー/ env/index.js:

var path = require('path'); var devConfigPath = path.join(__dirname, './development.js'); 
var productionConfigPath = path.join(__dirname, './production.js'); 
var testConfigPath = path.join(__dirname, './testing.js');  
if (process.env.NODE_ENV === 'production') { module.exports = 
require(productionConfigPath); } 
else if (process.env.NODE_ENV === 'testing') { module.exports = require(testConfigPath); } 
else { module.exports = require(devConfigPath); } 

これはどういう意味ですか?私は、同じ問題と提案された回答の記事を調査しましたが、何も本当に助けてくれません。

+0

プロジェクトにProcfileを追加しようとしましたか? – andresk

+0

はい、私の編集を参照してください - 私はどこにサーバーを起動する私のprocfileコードが含まれています。問題はデータベースになると思う - 私は自分のローカルデータベース(postgres // localhost/xxx)にリンクしているコードをheroku配備のアプリ(herokuにURLを付けて)に追加したコードと交換しました。他に何かがあったらどうしたらいいのか?最初に展開する.. – javascript2016

+0

ハムはいけません。 package.jsonで手動でノードのバージョンを設定してみることもできます。 – andresk

答えて

0

setting the Node and NPM versionsは、ローカルで(同じ場所で)使用するように試すことができます。

また、explicitly configure to do so以外の場合、Herokuはインストールしないため、devの依存関係を見逃していないことを確認してください。

UPDATE:

あなたのコメントから、あなたがHerokuのような本番環境であなたのコードを実行すると、データベースのURLがDATABASE_URIという環境変数から取得されているようです。この変数をprocess.env.DATABASE_URIに変更すると、アドオンを追加したときにアプリケーションに追加されたenv varのキーと一致するようになります。または、希望の値で環境変数を作成できます。詳細については、thisをお読みください

+0

私が使用しているノードのバージョンを確認し、package.jsonファイルに追加しましたが、何も変更されていません。 Im依存関係についてはわかりません - Imが1つ不足しているかどうかを確認するにはどうすればよいですか?また、これはドキュメントのregにあります。デフォルトではNPM_CONFIG_PRODUCTIONをtrueに設定して、プロダクションの依存関係のみをインストールします。もし、あなたがdevDependenciesをインストールしたいのであれば、生産モードを無効にすることができます: $ heroku config:set NPM_CONFIG_PRODUCTION = false – javascript2016

+0

package.jsonに 'devDependencies'がある場合、コマンドを使うとHerokuにのみインストールされます – andresk

+0

この行に対応するコードは? '(/app/server/db/index.js:2:10)'(壊れているようです) – andresk

関連する問題