2017-04-18 98 views
0

在Heroku上部署Node.js應用程序時出現以下錯誤。將Node.js應用程序部署到Heroku時出錯

2017-04-18T18:40:10.158442 + 00:00 app [web.1]:npm ERR!請在任何支持請求中包含以下文件:

2017-04-18T18:40:10.158544 + 00:00 app [web.1]:npm ERR! /app/npm-debug.log

2017-04-18T18:40:10.237236 + 00:00的Heroku [web.1]:狀態從開始變爲墜毀

2017-04-18T18:40: 10.230110 + 00:00 heroku [web.1]:進程退出狀態1

2017-04-18T18:40:29.015395 + 00:00 heroku [router]:at = error code = H10 desc =「應用程序崩潰「method = GET path =」/「host = nandu-varun-webdev.herokuapp.com request_id = 11f3e405-089e-4bef-a83c-f190b042fbb7 fwd =」216.15.126.238「dyno = connect = service = status = 503 bytes = protocol = https

2017-04-18T18:40:29.282812 + 00:00 heroku [router]:at = error c ode = H10 desc =「App crashed」method = GET path =「/ favicon.ico」host = nandu-varun-webdev.herokuapp.com request_id = 904f2f85-9c15-4601-bb9a-51a58c7544e1 fwd =「216.15.126.238」dyno = =連接服務=狀態= 503字節= =協議HTTPS

我的package.json文件如下

{ 
    "name": "web-dev", 
    "version": "1.0.0", 
    "description": "Web Dev", 
    "main": "server.js", 
    "dependencies": { 
    "body-parser": "^1.15.1", 
    "express": "^4.13.4", 
    "mongoose": "^4.4.15", 
    "multer":"^1.3.0", 
    "q": "^1.4.1", 
    "passport": "^0.3.2", 
    "passport-local": "^1.0.0", 
    "cookie-parser": "^1.4.1", 
    "bcrypt-nodejs": "0.0.3", 
    "node-uuid": "^1.4.7", 
    "express-session": "^1.13.0" 

    }, 
    "devDependencies": {}, 
    "scripts": { 
    "test": "echo \"Error: no test specified\" && exit 1", 
    "start": "node server.js" 
    }, 
    "author": "VN", 
    "license": "ISC" 
} 

而且我Server.js文件如下:

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

var bodyParser = require('body-parser'); 
app.use(bodyParser.urlencoded({ extended: true })); 
app.use(bodyParser.json()); 

// configure a public directory to host static content 
app.use(express.static(__dirname + '/public')); 

require ("./test/app.js")(app); 
require ("./assignment/app.js")(app); 
require ("./project/app")(app); 

var port = process.env.PORT || 3000; 

app.listen(port); 

編輯:這些是我得到的完整日誌

2017-04-19T11:38:05.924799 + 00:00 app [web.1]:npm ERR!如果你這樣做,這很可能是一個web-dev包的問題,​​

2017-04-19T11:38:05.925332 + 00:00 app [web.1]:npm ERR!您可以通過以下方式獲得有關如何爲此項目打開問題的信息:

2017-04-19T11:38:05.925449 + 00:00 app [web.1]:npm ERR! npm bugs web-dev

2017-04-19T11:38:05.925583 + 00:00 app [web.1]:npm ERR!或者如果沒有,您可以通過以下方式獲取他們的信息:

2017-04-19T11:38:05.925712 + 00:00 app [web.1]:npm ERR! npm owner ls web-dev

2017-04-19T11:38:05.925846 + 00:00 app [web.1]:npm ERR!上面可能還有其他日誌記錄輸出。

2017-04-19T11:38:05.930287 + 00:00應用程式[web.1]:

2017-04-19T11:38:05.930497 + 00:00應用程式[web.1]:NPM ERR !請在任何支持請求中包含以下文件:

2017-04-19T11:38:05.930608 + 00:00 app [web.1]:npm ERR! /app/npm-debug.log

2017-04-19T11:38:06.002754 + 00:00的Heroku [web.1]:狀態從開始變爲墜毀

2017-04-19T11:38: 05。995921 + 00:00 heroku [web.1]:進程退出狀態1

2017-04-19T14:44:20.909797 + 00:00 heroku [router]:at = error code = H10 desc =「應用程序崩潰「method = GET path =」/「host = nandu-varun-webdev.herokuapp.com request_id = ab500e0f-0137-4b2f-ae8d-fb99c0849597 fwd =」216.15.126.238「dyno = connect = service = status = 503 bytes = protocol = https

2017-04-19T14:44:21.392032 + 00:00 heroku [router]:at = error code = H10 desc =「App crashed」method = GET path =「/ favicon.ico」host = nandu -varun-webdev.herokuapp.com REQUEST_ID = 6a277e5f-2329-45d1-82af-4a4cd170e028 FWD = 「216.15.126.238」 DYNO =連接=服務=狀態= 503個字節=協議= HTTPS

我只是無法弄清楚問題是什麼或爲什麼我無法成功部署。

任何幫助,將不勝感激

在此先感謝

+0

這些日誌^^不是你需要的。進一步瞭解應用程序在崩潰時生成的堆棧跟蹤。 – hunterloftis

回答

1

你必須創建一個Procfile包含此:

web: npm start 

你有嗎?

+0

不,我沒有,我怎麼做 – Varun

+0

創建應包含網絡文件Procfile:npm start。推它,讓我們看看會發生什麼 –

+0

它的工作感謝 – Varun