我在将反应应用程序部署到heroku时遇到了麻烦。我使用以下样板作为起点:https://github.com/reactGo/reactGo,但我将它与我现有的应用程序结合起来。我在本地测试它并且运行/构建正常,但是heroku给了我以下错误:
2017-05-10T21:43:07.399992+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-05-10T21:43:07.400522+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-05-10T21:43:07.615526+00:00 heroku[web.1]: Process exited with status 137
2017-05-10T21:43:07.631086+00:00 heroku[web.1]: State changed from starting to crashed
2017-05-10T21:43:07.632321+00:00 heroku[web.1]: State changed from crashed to starting
2017-05-10T21:43:13.661987+00:00 heroku[web.1]: Starting process with command `npm start`
2017-05-10T21:43:16.475503+00:00 app[web.1]:
2017-05-10T21:43:16.475524+00:00 app[web.1]: > react-webpack-node@3.4.1 start /app
2017-05-10T21:43:16.475526+00:00 app[web.1]: > npm run build && cross-env NODE_ENV=production node compiled/server.js
2017-05-10T21:43:16.475526+00:00 app[web.1]:
2017-05-10T21:43:16.944768+00:00 app[web.1]:
2017-05-10T21:43:16.944783+00:00 app[web.1]: > react-webpack-node@3.4.1 build /app
2017-05-10T21:43:16.944787+00:00 app[web.1]: > npm run clean && cross-env NODE_ENV=production npm run webpack -- --env.browser && cross-env NODE_ENV=production npm run webpack -- --env.server
2017-05-10T21:43:16.944788+00:00 app[web.1]:
2017-05-10T21:43:17.328771+00:00 app[web.1]:
2017-05-10T21:43:17.328785+00:00 app[web.1]: > react-webpack-node@3.4.1 clean /app
2017-05-10T21:43:17.328786+00:00 app[web.1]: > rimraf public && rimraf compiled
2017-05-10T21:43:17.328787+00:00 app[web.1]:
2017-05-10T21:43:18.095069+00:00 app[web.1]:
2017-05-10T21:43:18.095084+00:00 app[web.1]: > react-webpack-node@3.4.1 webpack /app
2017-05-10T21:43:18.095085+00:00 app[web.1]: > webpack --colors --display-error-details --config ./webpack/webpack.config.js "--env.browser"
2017-05-10T21:43:18.095086+00:00 app[web.1]:
2017-05-10T21:43:18.812288+00:00 app[web.1]: Running webpack in production mode on browser
2017-05-10T21:43:35.602105+00:00 heroku[run.4255]: Process exited with status 130
2017-05-10T21:43:35.611860+00:00 heroku[run.4255]: State changed from up to complete
2017-05-10T21:43:59.732215+00:00 heroku[web.1]: Process running mem=543M(106.1%)
2017-05-10T21:43:59.732277+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-05-10T21:44:13.716290+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-05-10T21:44:13.716376+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-05-10T21:44:13.741192+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2017-05-10T21:44:13.966647+00:00 heroku[web.1]: State changed from starting to crashed
2017-05-10T21:44:13.954005+00:00 heroku[web.1]: Process exited with status 22
2017-05-10T21:44:16.287420+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=boiling-spire-17544.herokuapp.com request_id=d4b52f95-a50e-4579-84a0-3b7411726415 fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
2017-05-10T21:44:24.777756+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=boiling-spire-17544.herokuapp.com request_id=1463bd52-de1d-4351-960d-aedf412c622a fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
2017-05-10T21:44:25.694845+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=boiling-spire-17544.herokuapp.com request_id=7735e9de-bc4d-4535-b06e-b004b9cc4c8b fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
2017-05-10T21:47:47.310866+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=boiling-spire-17544.herokuapp.com request_id=de042817-c34a-45e1-88ba-03eaeb78dd19 fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
2017-05-10T21:47:48.232781+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=boiling-spire-17544.herokuapp.com request_id=8edae68e-5bb8-444e-94e3-cffafb392b15 fwd="24.207.50.90" dyno= connect= service= status=503 bytes= protocol=https
这是我尝试过的失败: -restarting heroku - 验证端口是否动态安装
有什么建议吗?
答案 0 :(得分:3)
您在启动过程中遇到R10错误:错误R10(启动超时) - > Web进程无法在启动后60秒内绑定到$ PORT
您应该忘记将服务器绑定到名为PORT
的环境变量。您必须从ReactGo样板文件中获得以下行:app.set('port', (process.env.PORT || 3000));
或更直接:app.listen(process.env.PORT || 3000);
OR
构建过程需要60多秒才能完成,这会导致您的dyno在构建应用程序之前终止。您需要使用专门的CI工具,如CircleCI(提供Heroku的连接器)来构建您的应用程序,然后在heroku上启动它。
R14不是Heroku中的严重错误,但会降低您的性能。如果你使用Heroku作为持续集成平台(正如我在你的日志中看到的那样),这在构建期间很容易发生。
答案 1 :(得分:1)
你得到"错误R14(超出内存配额)"。 查看R14 - Memory Quota Exceeded以查看一些可能的提示。 也许你在一个dyno中包含了太多的功能? 您的Procfile是什么样的,以及您使用的是哪些dyno类型?