2016-10-25 4 views
1

나는 Heroku를 통해 node.js를 배포하려고합니다. 그러나 응용 프로그램 오류가 있습니다.Heroku node.js app crashing

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도 작동하지 않습니다. 다른 이유가있을 수 있습니까? –