2016-03-20 21 views
0

が起きていない私はHerokuのにノードプロジェクトを展開し、それがアプリケーションエラー以下Herokuの展開が

言う以下急行ファイルです

var express = require('express'), 
    http = require('http'); 
var bodyParser = require('body-parser'); 
var app = express() 
    .use(bodyParser.urlencoded()) 
    .use(express.static(__dirname + '/public')) 
    .use('/node_modules', express.static(__dirname + '/node_modules')); 

は、Herokuの

2016-03-20T09:21:02.381628+00:00 heroku[web.1]: State changed from crashed to starting 
2016-03-20T09:21:03.470949+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-03-20T09:21:06.258287+00:00 app[web.1]: 
2016-03-20T09:21:06.321039+00:00 app[web.1]: ^
2016-03-20T09:21:06.258314+00:00 app[web.1]: > node server.js 
2016-03-20T09:21:06.258312+00:00 app[web.1]: > [email protected] start /app 
2016-03-20T09:21:06.258314+00:00 app[web.1]: 
2016-03-20T09:21:06.321038+00:00 app[web.1]:  throw err; 
2016-03-20T09:21:06.321061+00:00 app[web.1]:  at Function.Module._resolveFilename (module.js:339:15) 
2016-03-20T09:21:06.321032+00:00 app[web.1]: module.js:341 
2016-03-20T09:21:06.321061+00:00 app[web.1]:  at Function.Module._load (module.js:290:25) 
2016-03-20T09:21:06.321044+00:00 app[web.1]: 
2016-03-20T09:21:06.321062+00:00 app[web.1]:  at require (internal/module.js:16:19) 
2016-03-20T09:21:06.321064+00:00 app[web.1]:  at Module._compile (module.js:413:34) 
2016-03-20T09:21:06.321053+00:00 app[web.1]: Error: Cannot find module 'express' 
2016-03-20T09:21:06.321064+00:00 app[web.1]:  at Object.Module._extensions..js (module.js:422:10) 
2016-03-20T09:21:06.321065+00:00 app[web.1]:  at Module.load (module.js:357:32) 
2016-03-20T09:21:06.321063+00:00 app[web.1]:  at Object.<anonymous> (/app/server.js:1:77) 
2016-03-20T09:21:06.321066+00:00 app[web.1]:  at Function.Module._load (module.js:314:12) 
2016-03-20T09:21:06.321066+00:00 app[web.1]:  at Function.Module.runMain (module.js:447:10) 
2016-03-20T09:21:06.321062+00:00 app[web.1]:  at Module.require (module.js:367:17) 
2016-03-20T09:21:06.335202+00:00 app[web.1]: npm ERR! Linux 3.13.0-79-generic 
2016-03-20T09:21:06.335744+00:00 app[web.1]: npm ERR! node v5.8.0 
2016-03-20T09:21:06.328269+00:00 app[web.1]: 
2016-03-20T09:21:06.335562+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start" 
2016-03-20T09:21:06.336060+00:00 app[web.1]: npm ERR! npm v3.7.3 
2016-03-20T09:21:06.336389+00:00 app[web.1]: npm ERR! [email protected] start: `node server.js` 
2016-03-20T09:21:06.336587+00:00 app[web.1]: npm ERR! 
2016-03-20T09:21:06.336281+00:00 app[web.1]: npm ERR! code ELIFECYCLE 
2016-03-20T09:21:06.336476+00:00 app[web.1]: npm ERR! Exit status 1 
2016-03-20T09:21:06.336685+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script 'node server.js'. 
2016-03-20T09:21:06.336786+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed. 
2016-03-20T09:21:06.336880+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the mean-app package, 
2016-03-20T09:21:06.337139+00:00 app[web.1]: npm ERR!  node server.js 
2016-03-20T09:21:06.336968+00:00 app[web.1]: npm ERR! not with npm itself. 
2016-03-20T09:21:06.337048+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system: 
2016-03-20T09:21:06.337580+00:00 app[web.1]: npm ERR! There is likely additional logging output above. 
2016-03-20T09:21:06.337227+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with: 
2016-03-20T09:21:06.337319+00:00 app[web.1]: npm ERR!  npm bugs mean-app 
2016-03-20T09:21:06.337402+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via: 
2016-03-20T09:21:06.341555+00:00 app[web.1]: 
2016-03-20T09:21:06.337500+00:00 app[web.1]: npm ERR!  npm owner ls mean-app 
2016-03-20T09:21:06.341875+00:00 app[web.1]: npm ERR! Please include the following file with any support request: 
2016-03-20T09:21:06.341966+00:00 app[web.1]: npm ERR!  /app/npm-debug.log 
2016-03-20T09:21:07.158614+00:00 heroku[web.1]: State changed from starting to crashed 
2016-03-20T09:21:07.137366+00:00 heroku[web.1]: Process exited with status 1 
2016-03-20T09:21:59.871731+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=m-e-a-n.herokuapp.com request_id=c8663e92-89be-4105-a971-d42250ecc574 fwd="49.206.213.175" dyno= connect= service= status=503 bytes= 
2016-03-20T09:22:00.525395+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=m-e-a-n.herokuapp.com request_id=f7c7eee7-ffac-4774-acda-5452eecfbd0d fwd="49.206.213.175" dyno= connect= service= status=503 bytes= 
のログです

これは私のpackage.jsonです

{ 
    "name": "mean-app", 
    "version": "1.0.0", 
    "description": "to develop mean application", 
    "main": "server.js", 
    "scripts": { 
    "test": "echo \"Error: no test specified\" && exit 1", 
    "start": "node server.js" 
    }, 
    "repository": { 
    "type": "git", 
    "url": "git+https://github.com/krthk2005/mean_project.git" 
    }, 
    "keywords": [ 
    "test", 
    "mean", 
    "project" 
    ], 
    "author": "kartheek", 
    "license": "MIT", 
    "bugs": { 
    "url": "https://github.com/krthk2005/mean_project/issues" 
    }, 
    "homepage": "https://github.com/krthk2005/mean_project#readme", 
    "dependencies": { 
    "bcrypt": "^0.8.5" 
    } 
} 

答えて

2

依存性としてpackage.jsonexpressbody-parserを追加する必要があります。

として:

"dependencies": {

`"express":"*",` 

`"body-parser":"*",` 

`"bcrypt": "^0.8.5"` 

}

Herokuのは、依存関係としてpackage.jsonに記載されているすべてのパッケージをnpm install経由して依存関係をインストールし、そのコマンドのダウンロードので。

+0

ええ、私の問題を解決しました。私はpackage.jsonファイルを削除し、再び作成しました...しかし、package.jsonを直接更新するにはどうすればいいですか...コマンドラインで更新する方法 –

+0

'npm init'が正しいpackage.jsonを生成する方法 –