2016-10-25 15 views
1

私は、Heroku経由でnode.jsをデプロイしようとしています。 しかし、アプリケーションエラーがあります。Heroku node.jsアプリケーションがクラッシュする

Counting objects: 3, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (3/3), done. 
Writing objects: 100% (3/3), 322 bytes | 0 bytes/s, done. 
Total 3 (delta 1), reused 0 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Node.js app detected 
remote: 
remote: -----> Creating runtime environment 
remote:   
remote:  NPM_CONFIG_LOGLEVEL=error 
remote:  NPM_CONFIG_PRODUCTION=true 
remote:  NODE_ENV=production 
remote:  NODE_MODULES_CACHE=true 
remote: 
remote: -----> Installing binaries 
remote:  engines.node (package.json): v6.8.1 
remote:  engines.npm (package.json): 3.10.8 
remote:   
remote:  Resolving node version v6.8.1 via semver.io... 
remote:  Downloading and installing node 6.8.1... 
remote:  npm 3.10.8 already installed with node 
remote: 
remote: -----> Restoring cache 
remote:  Loading 2 from cacheDirectories (default): 
remote:  - node_modules 
remote:  - bower_components (not cached - skipping) 
remote: 
remote: -----> Building dependencies 
remote:  Installing node modules (package.json) 
remote: 
remote: -----> Caching build 
remote:  Clearing previous node cache 
remote:  Saving 2 cacheDirectories (default): 
remote:  - node_modules 
remote:  - bower_components (nothing to cache) 
remote: 
remote: -----> Build succeeded! 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  └── [email protected] 
remote:   
remote: -----> Discovering process types 
remote:  Procfile declares types  -> (none) 
remote:  Default types for buildpack -> web 
remote: 
remote: -----> Compressing... 
remote:  Done: 14.5M 
remote: -----> Launching... 
remote:  Released v9 
remote:  https://sawartc.herokuapp.com/ deployed to Heroku 
remote: 
remote: Verifying deploy... done. 
To https://git.heroku.com/sawartc.git 
    7d9216c..973d8ba master -> master 
sawamuratakashikan-no-MacBook-Pro:node sawamuratakahiro$ heroku open 

この展開は成功する可能性があります。

ですが、アプリケーションエラーが発生します。

そして、これはherokuログです。

2016-10-24T15:25:07.521109+00:00 heroku[web.1]: State changed from starting to crashed 
2016-10-24T15:25:07.500572+00:00 heroku[web.1]: Process exited with status 137 
2016-10-24T17:10:24.410630+00:00 heroku[web.1]: State changed from crashed to starting 
2016-10-24T17:10:26.487227+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-10-24T17:10:29.973959+00:00 app[web.1]: 
2016-10-24T17:10:29.973971+00:00 app[web.1]: > [email protected] start /app 
2016-10-24T17:10:29.973972+00:00 app[web.1]: > node sampleapp.js 
2016-10-24T17:10:29.973973+00:00 app[web.1]: 
2016-10-24T17:10:30.163591+00:00 app[web.1]: Server running at http://127.0.0.1:1337/ 
2016-10-24T17:11:26.793014+00:00 app[web.1]: Error waiting for process to terminate: No child processes 
2016-10-24T17:11:26.755681+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
2016-10-24T17:11:26.755825+00:00 heroku[web.1]: Stopping process with SIGKILL 
2016-10-24T17:11:26.903907+00:00 heroku[web.1]: Process exited with status 22 
2016-10-24T17:11:26.919339+00:00 heroku[web.1]: State changed from starting to crashed 
2016-10-24T20:08:20.748447+00:00 heroku[web.1]: State changed from crashed to starting 
2016-10-24T20:08:22.155076+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-10-24T20:08:24.669537+00:00 app[web.1]: > [email protected] start /app 
2016-10-24T20:08:24.669514+00:00 app[web.1]: 
2016-10-24T20:08:24.669538+00:00 app[web.1]: > node sampleapp.js 
2016-10-24T20:08:24.669539+00:00 app[web.1]: 
2016-10-24T20:08:24.786219+00:00 app[web.1]: Server running at http://127.0.0.1:1337/ 
2016-10-24T20:09:22.309836+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
2016-10-24T20:09:22.309836+00:00 heroku[web.1]: Stopping process with SIGKILL 
2016-10-24T20:09:22.399015+00:00 heroku[web.1]: Process exited with status 137 
2016-10-24T20:09:22.406141+00:00 heroku[web.1]: State changed from starting to crashed 
2016-10-25T01:40:39.946449+00:00 heroku[web.1]: State changed from crashed to starting 
2016-10-25T01:40:41.519699+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-10-25T01:40:43.843569+00:00 app[web.1]: 
2016-10-25T01:40:43.843581+00:00 app[web.1]: > [email protected] start /app 
2016-10-25T01:40:43.843581+00:00 app[web.1]: > node sampleapp.js 
2016-10-25T01:40:43.843582+00:00 app[web.1]: 
2016-10-25T01:40:43.943591+00:00 app[web.1]: Server running at http://127.0.0.1:1337/ 
2016-10-25T01:41:42.057140+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
2016-10-25T01:41:42.057234+00:00 heroku[web.1]: Stopping process with SIGKILL 
2016-10-25T01:41:42.172614+00:00 heroku[web.1]: Process exited with status 137 
2016-10-25T01:41:42.207278+00:00 heroku[web.1]: State changed from starting to crashed 
2016-10-25T03:42:53.015078+00:00 heroku[api]: Deploy 2e44739 by 
2016-10-25T03:42:53.015138+00:00 heroku[api]: Release v7 created by 
2016-10-25T03:42:53.546204+00:00 heroku[slug-compiler]: Slug compilation finished 
2016-10-25T03:42:53.546194+00:00 heroku[slug-compiler]: Slug compilation started 
2016-10-25T03:42:53.630591+00:00 heroku[web.1]: State changed from crashed to starting 
2016-10-25T03:42:54.901534+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-10-25T03:42:57.073592+00:00 app[web.1]: 
2016-10-25T03:42:57.073608+00:00 app[web.1]: > [email protected] start /app 
2016-10-25T03:42:57.073608+00:00 app[web.1]: > node sampleapp.js 
2016-10-25T03:42:57.192757+00:00 app[web.1]: Server running at http://127.0.0.1:1337/ 
2016-10-25T03:42:57.073609+00:00 app[web.1]: 
2016-10-25T03:43:55.242924+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
2016-10-25T03:43:55.242924+00:00 heroku[web.1]: Stopping process with SIGKILL 
2016-10-25T03:43:55.403793+00:00 heroku[web.1]: Process exited with status 137 
2016-10-25T03:43:55.418227+00:00 heroku[web.1]: State changed from starting to crashed 
2016-10-25T03:43:55.419140+00:00 heroku[web.1]: State changed from crashed to starting 
2016-10-25T03:43:56.641767+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-10-25T03:43:58.885658+00:00 app[web.1]: > [email protected] start /app 
2016-10-25T03:43:58.885646+00:00 app[web.1]: 
2016-10-25T03:43:58.885659+00:00 app[web.1]: > node sampleapp.js 
2016-10-25T03:43:58.885663+00:00 app[web.1]: 
2016-10-25T03:43:58.988687+00:00 app[web.1]: Server running at http://127.0.0.1:1337/ 
2016-10-25T03:44:20.981992+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=sawartc.herokuapp.com request_id=19ae4ca5-679f-4ef1-9e5c-9408dd6963b2 fwd="219.117.193.211" dyno= connect= service= status=503 bytes= 
2016-10-25T03:44:57.129700+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
2016-10-25T03:44:57.129700+00:00 heroku[web.1]: Stopping process with SIGKILL 
2016-10-25T03:44:57.244921+00:00 heroku[web.1]: State changed from starting to crashed 
2016-10-25T03:44:57.267311+00:00 heroku[web.1]: Process exited with status 137 

このnode.jsアプリケーションを展開するにはどうすればよいですか。

+0

ローカルで実行するとどうなりますか? –

答えて

1

ログから、動的ポート1337にバインドしているようですが、これはローカルで実行されますが、Herokuではポート8080しか使用できません。あなたのポートを定義するための最善のアプローチは、次のとおりです。

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

ので、Herokuのは、ローカルでコードを実行している間、あなたはまだ1337ポートを使用することができ、そのポートを使用しています。

+0

私は同じ問題を抱えています。しかし、ポート8080も機能しません。何か他の理由がありますか? –

関連する問題