首页 > 解决方案 > 使用 Heroku 构建成功,但应用程序错误

问题描述

请允许我解释一下。我使用 Heroku 来启用我的在线应用程序 (React/Redux)。

所以,我的构建已经正确完成,但是当我查看时log我发现了这个错误:

at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=desolate-river-47144.herokuapp.com request_id=334501ef-1403-4ba3-a69e-3587b44dd79c fwd="xx.xxx.xx.xx" dyno= connect= service= status=503 bytes= protocol=https

fwd包含我的 IP 地址)

我只有这个错误。我试过heroku restart了,但问题仍然存在。

我所有的日志如下。如你所见,一切都已建成——这就是我不明白的。

2018-05-20T17:06:13.022497+00:00 app[web.1]: [192] ./~/react-redux/~/lodash/_getRawTag.js 1.14 kB {0} [built] 2018-05-20T17:06:13.022494+00:00 app[web.1]: [190] ./~/react-redux/~/lodash/_root.js 300 bytes {0} [built] 2018-05-20T17:06:13.022499+00:00 app[web.1]: [193] ./~/react-redux/~/lodash/_objectToString.js 565 bytes {0} [built] 2018-05-20T17:06:13.022501+00:00 app[web.1]: [194] ./~/react-redux/~/lodash/_getPrototype.js 163 bytes {0} [built] 2018-05-20T17:06:13.022502+00:00 app[web.1]: [195] ./~/react-redux/~/lodash/_overArg.js 382 bytes {0} [built] 2018-05-20T17:06:13.022504+00:00 app[web.1]: [196] ./~/react-redux/~/lodash/isObjectLike.js 614 bytes {0} [built] 2018-05-20T17:06:13.022506+00:00 app[web.1]: [197] ./~/react-redux/~/hoist-non-react-statics/index.js 1.39 kB {0} [built] 2018-05-20T17:06:13.022507+00:00 app[web.1]: [198] ./~/invariant/browser.js 1.4 kB {0} [built] 2018-05-20T17:06:13.022509+00:00 app[web.1]: [199] ./src/routes.js 3.13 kB {0} [built] 2018-05-20T17:06:13.022510+00:00 app[web.1]: [200] ./~/react-router-dom/index.js 2.17 kB {0} [built] 2018-05-20T17:06:13.022512+00:00 app[web.1]: [201] ./~/react-router-dom/BrowserRouter.js 2.98 kB {0} [built] 2018-05-20T17:06:13.022513+00:00 app[web.1]: [202] ./~/warning/browser.js 1.81 kB {0} [built] 2018-05-20T17:06:13.022515+00:00 app[web.1]: [203] ./~/prop-types/index.js 956 bytes {0} [built] 2018-05-20T17:06:13.022517+00:00 app[web.1]: [204] ./~/prop-types/factoryWithTypeCheckers.js 19.8 kB {0} [built] 2018-05-20T17:06:13.022518+00:00 app[web.1]: [205] ./~/fbjs/lib/emptyFunction.js 959 bytes {0} [built] 2018-05-20T17:06:13.022520+00:00 app[web.1]: [206] ./~/fbjs/lib/invariant.js 1.51 kB {0} [built] 2018-05-20T17:06:13.022521+00:00 app[web.1]: [207] ./~/fbjs/lib/warning.js 1.9 kB {0} [built] 2018-05-20T17:06:13.022523+00:00 app[web.1]: [208] ./~/object-assign/index.js 2.11 kB {0} [built] 2018-05-20T17:06:13.022525+00:00 app[web.1]: [209] ./~/prop-types/lib/ReactPropTypesSecret.js 314 bytes {0} [built] 2018-05-20T17:06:13.022526+00:00 app[web.1]: [210] ./~/prop-types/checkPropTypes.js 2.87 kB {0} [built] 2018-05-20T17:06:13.022528+00:00 app[web.1]: [211] ./~/prop-types/factoryWithThrowingShims.js 1.49 kB {0} [built] 2018-05-20T17:06:13.022530+00:00 app[web.1]: [212] ./~/history/createBrowserHistory.js 9.75 kB {0} [built] 2018-05-20T17:06:13.022531+00:00 app[web.1]: [213] ./~/history/LocationUtils.js 2.65 kB {0} [built] 2018-05-20T17:06:13.022533+00:00 app[web.1]: [214] ./~/resolve-pathname/cjs/index.js 1.88 kB {0} [built] 2018-05-20T17:06:13.022534+00:00 app[web.1]: [215] ./~/value-equal/cjs/index.js 1.22 kB {0} [built] 2018-05-20T17:06:13.022536+00:00 app[web.1]: [216] ./~/history/PathUtils.js 1.77 kB {0} [built] 2018-05-20T17:06:13.022538+00:00 app[web.1]: [217] ./~/history/createTransitionManager.js 2.36 kB {0} [built] 2018-05-20T17:06:13.022539+00:00 app[web.1]: [218] ./~/history/DOMUtils.js 2.49 kB {0} [built] 2018-05-20T17:06:13.022541+00:00 app[web.1]: [219] ./~/react-router-dom/Router.js 334 bytes {0} [built] 2018-05-20T17:06:13.022543+00:00 app[web.1]: [220] ./~/react-router/Router.js 4.27 kB {0} [built] 2018-05-20T17:06:13.022544+00:00 app[web.1]: [221] ./~/react-router-dom/HashRouter.js 2.93 kB {0} [built] 2018-05-20T17:06:13.022546+00:00 app[web.1]: [222] ./~/history/createHashHistory.js 10.1 kB {0} [built] 2018-05-20T17:06:13.022547+00:00 app[web.1]: [223] ./~/react-router-dom/Link.js 4.56 kB {0} [built] 2018-05-20T17:06:13.022549+00:00 app[web.1]: [224] ./~/react-router-dom/MemoryRouter.js 364 bytes {0} [built] 2018-05-20T17:06:13.022550+00:00 app[web.1]: [225] ./~/react-router/MemoryRouter.js 2.98 kB {0} [built] 2018-05-20T17:06:13.022552+00:00 app[web.1]: [226] ./~/history/createMemoryHistory.js 5.82 kB {0} [built] 2018-05-20T17:06:13.022553+00:00 app[web.1]: [227] ./~/react-router-dom/NavLink.js 3.16 kB {0} [built] 2018-05-20T17:06:13.022555+00:00 app[web.1]: [228] ./~/react-router-dom/Route.js 329 bytes {0} [built] 2018-05-20T17:06:13.022556+00:00 app[web.1]: [229] ./~/react-router/Route.js 6.76 kB {0} [built] 2018-05-20T17:06:13.022558+00:00 app[web.1]: [230] ./~/react-router/matchPath.js 2.27 kB {0} [built] 2018-05-20T17:06:13.022560+00:00 app[web.1]: [231] ./~/path-to-regexp/index.js 10.8 kB {0} [built] 2018-05-20T17:06:13.022561+00:00 app[web.1]: [232] ./~/isarray/index.js 120 bytes {0} [built] 2018-05-20T17:06:13.022563+00:00 app[web.1]: [233] ./~/react-router-dom/Prompt.js 334 bytes {0} [built] 2018-05-20T17:06:13.022564+00:00 app[web.1]: [234] ./~/react-router/Prompt.js 3.09 kB {0} [built] 2018-05-20T17:06:13.022566+00:00 app[web.1]: [235] ./~/react-router-dom/Redirect.js 344 bytes {0} [built] 2018-05-20T17:06:13.022568+00:00 app[web.1]: [236] ./~/react-router/Redirect.js 3.65 kB {0} [built] 2018-05-20T17:06:13.022570+00:00 app[web.1]: [237] ./~/history/index.js 1.58 kB {0} [built] 2018-05-20T17:06:13.022571+00:00 app[web.1]: [238] ./~/react-router-dom/StaticRouter.js 364 bytes {0} [built] 2018-05-20T17:06:13.022573+00:00 app[web.1]: [239] ./~/react-router/StaticRouter.js 6.92 kB {0} [built] 2018-05-20T17:06:13.022575+00:00 app[web.1]: [240] ./~/react-router-dom/Switch.js 334 bytes {0} [built] 2018-05-20T17:06:13.022576+00:00 app[web.1]: [241] ./~/react-router/Switch.js 3.86 kB {0} [built] 2018-05-20T17:06:13.022578+00:00 app[web.1]: [242] ./~/react-router-dom/matchPath.js 349 bytes {0} [built] 2018-05-20T17:06:13.022580+00:00 app[web.1]: [243] ./~/react-router-dom/withRouter.js 354 bytes {0} [built] 2018-05-20T17:06:13.022581+00:00 app[web.1]: [244] ./~/react-router/withRouter.js 1.86 kB {0} [built] 2018-05-20T17:06:13.022583+00:00 app[web.1]: [245] ./~/hoist-non-react-statics/index.js 2.6 kB {0} [built] 2018-05-20T17:06:13.022584+00:00 app[web.1]: [246] ./src/components/Posts.js 4.52 kB {0} [built] 2018-05-20T17:06:13.022586+00:00 app[web.1]: [247] ./src/actions/index.js 1.24 kB {0} [built] 2018-05-20T17:06:13.022588+00:00 app[web.1]: [248] ./src/actions/actions-type.js 338 bytes {0} [built] 2018-05-20T17:06:13.022589+00:00 app[web.1]: [249] ./~/axios/index.js 40 bytes {0} [built] 2018-05-20T17:06:13.022591+00:00 app[web.1]: [250] ./~/axios/lib/axios.js 1.37 kB {0} [built] 2018-05-20T17:06:13.022592+00:00 app[web.1]: [251] ./~/axios/lib/utils.js 7.54 kB {0} [built] 2018-05-20T17:06:13.022594+00:00 app[web.1]: [252] ./~/axios/lib/helpers/bind.js 256 bytes {0} [built] 2018-05-20T17:06:13.022596+00:00 app[web.1]: [253] ./~/is-buffer/index.js 698 bytes {0} [built] 2018-05-20T17:06:13.022597+00:00 app[web.1]: [254] ./~/axios/lib/core/Axios.js 2.19 kB {0} [built] 2018-05-20T17:06:13.022599+00:00 app[web.1]: [255] ./~/axios/lib/defaults.js 2.43 kB {0} [built] 2018-05-20T17:06:13.022606+00:00 app[web.1]: [256] ./~/axios/lib/helpers/normalizeHeaderName.js 357 bytes {0} [built] 2018-05-20T17:06:13.022608+00:00 app[web.1]: [257] ./~/axios/lib/adapters/xhr.js 6.17 kB {0} [built] 2018-05-20T17:06:13.022610+00:00 app[web.1]: [258] ./~/axios/lib/core/settle.js 757 bytes {0} [built] 2018-05-20T17:06:13.022612+00:00 app[web.1]: [259] ./~/axios/lib/core/createError.js 625 bytes {0} [built] 2018-05-20T17:06:13.022613+00:00 app[web.1]: [260] ./~/axios/lib/core/enhanceError.js 592 bytes {0} [built] 2018-05-20T17:06:13.022615+00:00 app[web.1]: [261] ./~/axios/lib/helpers/buildURL.js 1.55 kB {0} [built] 2018-05-20T17:06:13.022617+00:00 app[web.1]: [262] ./~/axios/lib/helpers/parseHeaders.js 1.39 kB {0} [built] 2018-05-20T17:06:13.022619+00:00 app[web.1]: [263] ./~/axios/lib/helpers/isURLSameOrigin.js 2.25 kB {0} [built] 2018-05-20T17:06:13.022620+00:00 app[web.1]: [264] ./~/axios/lib/helpers/btoa.js 986 bytes {0} [built] 2018-05-20T17:06:13.022622+00:00 app[web.1]: [265] ./~/axios/lib/helpers/cookies.js 1.36 kB {0} [built] 2018-05-20T17:06:13.022624+00:00 app[web.1]: [266] ./~/axios/lib/core/InterceptorManager.js 1.25 kB {0} [built] 2018-05-20T17:06:13.022625+00:00 app[web.1]: [267] ./~/axios/lib/core/dispatchRequest.js 2.2 kB {0} [built] 2018-05-20T17:06:13.022627+00:00 app[web.1]: [268] ./~/axios/lib/core/transformData.js 550 bytes {0} [built] 2018-05-20T17:06:13.022629+00:00 app[web.1]: [269] ./~/axios/lib/cancel/isCancel.js 102 bytes {0} [built] 2018-05-20T17:06:13.022631+00:00 app[web.1]: [270] ./~/axios/lib/helpers/isAbsoluteURL.js 563 bytes {0} [built] 2018-05-20T17:06:13.022632+00:00 app[web.1]: [271] ./~/axios/lib/helpers/combineURLs.js 380 bytes {0} [built] 2018-05-20T17:06:13.022634+00:00 app[web.1]: [272] ./~/axios/lib/cancel/Cancel.js 385 bytes {0} [built] 2018-05-20T17:06:13.022636+00:00 app[web.1]: [273] ./~/axios/lib/cancel/CancelToken.js 1.24 kB {0} [built] 2018-05-20T17:06:13.022637+00:00 app[web.1]: [274] ./~/axios/lib/helpers/spread.js 564 bytes {0} [built] 2018-05-20T17:06:13.022639+00:00 app[web.1]: [275] ./src/components/Post.js 3.39 kB {0} [built] 2018-05-20T17:06:13.022640+00:00 app[web.1]: [276] ./src/components/RouteNotFound.js 2.42 kB {0} [built] 2018-05-20T17:06:13.022642+00:00 app[web.1]: [277] ./src/reducers/index.js 608 bytes {0} [built] 2018-05-20T17:06:13.022643+00:00 app[web.1]: [278] ./src/reducers/Posts-reducer.js 703 bytes {0} [built] 2018-05-20T17:06:13.022645+00:00 app[web.1]: [279] ./src/reducers/activePost-reducer.js 418 bytes {0} [built] 2018-05-20T17:06:13.023213+00:00 app[web.1]: webpack: Compiled successfully. 2018-05-20T17:06:46.501296+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=desolate-river-47144.herokuapp.com request_id=e8a9dd79-4bce-4701-ba86-59b43014372f fwd="77.144.48.66" dyno= connect= service= status=503 bytes= protocol=https 2018-05-20T17:07:06.721306+00:00 app[web.1]: Error waiting for process to terminate: No child processes 2018-05-20T17:07:06.686809+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 2018-05-20T17:07:06.687045+00:00 heroku[web.1]: Stopping process with SIGKILL 2018-05-20T17:07:06.819749+00:00 heroku[web.1]: Process exited with status 22 2018-05-20T17:07:07.316344+00:00 heroku[web.1]: State changed from starting to crashed 2018-05-20T17:07:10.468356+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=desolate-river-47144.herokuapp.com request_id=42afaab0-f2ca-4c14-bfab-8b364bb5b7fb fwd="77.144.48.66" dyno= connect= service= status=503 bytes= protocol=https 2018-05-20T17:07:12.928299+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=desolate-river-47144.herokuapp.com request_id=b1b60a3d-dcd6-47b0-be36-5e46e078b5e8 fwd="77.144.48.66" dyno= connect= service= status=503 bytes= protocol=https 2018-05-20T17:07:24.422621+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=desolate-river-47144.herokuapp.com request_id=c90f89dd-3c73-4086-87bb-62758b4f0698 fwd="77.144.48.66" dyno= connect= service= status=503 bytes= protocol=https 2018-05-20T17:07:25.323510+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=desolate-river-47144.herokuapp.com request_id=374cc4d9-f87d-471a-a6c6-071e8664476b fwd="77.144.48.66" dyno= connect= service= status=503 bytes= protocol=https

标签: htmlreactjsherokuwebpackredux

解决方案


我最好的猜测是你的服务器没有监听 Heroku 期望它监听的端口。

这两行日志表明这对我来说可能是这种情况,特别是因为在第一行之前,自进程上次记录任何内容以来,大约有 30 秒的间隔。

2018-05-20T17:06:46.501296+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=desolate-river-47144.herokuapp.com request_id=e8a9dd79-4bce-4701-ba86-59b43014372f fwd="77.144.48.66" dyno= connect= service= status=503 bytes= protocol=https

2018-05-20T17:07:06.686809+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

无论您在哪里设置服务器侦听的端口,请尝试执行类似的操作const port = process.env.PORT || 3000


推荐阅读