2017-05-26 17 views
0

ローカルに問題なく実行されているノードアプリケーションがありますが、herokuで展開しようとするとできません。私が得るエラーは: HerokuにアップロードするとアプリケーションがクラッシュしたH10エラーコード

2017-05-26T13:37:31.249587+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=engageitvisz.herokuapp.com request_id=e9641b76-0667-44ce-b85a-fb431c1cca2a fwd="31.10.149.171" dyno= connect= service= status=503 bytes= protocol=https
私のアプリケーションでmongoLabを使用していますが、私はherokuのアドオンとして追加しました。私がしようとしているように、あなたはどんな提案を持っているなら、私に知らせてください

{ 
    "name": "engageit", 
    "version": "1.0.0", 
    "description": "EngageIt visualization", 
    "main": "server.js", 
    "dependencies": { 
    "express": "4.13.1" 
    }, 
    "repository": { 
    "type": "git", 
    "url": "https://github.com/VitezKoja92/EngageItVisz.git" 
    }, 
    "scripts": { 
    "test": "test", 
    "start": "node server.js", 
    "heroku-prebuild": "echo This runs before Heroku installs your dependencies.", 
    "heroku-postbuild": "echo This runs afterwards." 
    }, 
    "author": "Danilo Krasic", 
    "license": "ISC", 
    "keywords": [ 
    "node", 
    "heroku", 
    "express" 
    ], 
    "engines": { 
    "node": "7.7.2" 
    } 
} 

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

var databaseUrl = "mongodb://user:[email protected]:37090/questions"; 
var collections = ["questions"]; 
var mongojs = require('mongojs'); 
var db = mongojs(databaseUrl, collections); 

app.set('port', (process.env.PORT || 5002)); 

var bodyParser = require('body-parser'); 
app.use(express.static(__dirname + "/public")); 
app.use(bodyParser.json()); 
app.use(bodyParser.urlencoded({extended: true})); 
app.get('/', function(request, response){ 
    response.send("Hello from server.js"); 
}); 

app.get('/questions', function(request, response){ 
    console.log("I received a GET request for questions"); 

db.questions.find(function(err, docs){ 
    if(err){ 
     response.send(err); 
    } 
    response.json(docs); 
    }) 
}); 
app.post('/questions', function(request, response){ 
    console.log("I received a POST request for questions"); 

}); 

app.listen(app.get('port'), function(){ 
    console.log('Server running on port', app.get('port')); 
}); 

Procfile:

web: node server.js 

package.jsonここserver.jsですこれを何時間も解決してください。

答えて

0
  • まず
  • 再度コミットあなたのHerokuのダッシュボードに移動して、あなたのgitにアプリをリンクherkouが
  • その後gitのハブとフォーク構文解析サーバの例に行くに展開する行く
0

私は同じ問題に直面していた:あなたはHerokuのヘルプページあたりとしてプロジェクトのルートで以下のコマンドを入力してMongoLab Herokuのアドオンから正しい接続URIを取得していることを確認してみてください。 Heroku nodejs app deployment, app crash
しかし、私はクラッシュの原因を見つけることができませんでしたログから、stackoverflow上の任意のソリューションが見つかりませんでした。
は最終的に私は(Herokuのはを作成) はランダムな名前でHerokuの上のアプリを作成し、私のローカルシステムから削除Procfileをaswell Herokuのからアプリを削除し、それが私のために働いた、Procfileなしのgitを使ってHerokuのにフォルダをプッシュして、Herokuのを再開しました。

関連する問題