简体   繁体   English

Heroku在部署react(Node)应用程序时出错

[英]Error in Heroku when deploying react (Node) app

I'm having troubles deploying a react app to heroku. 我遇到了将反应应用程序部署到heroku的麻烦。 I'm using the following boilerplate as a starting point: https://github.com/reactGo/reactGo , but I combined it with an existing app of mine. 我使用以下样板作为起点: https//github.com/reactGo/reactGo ,但我将它与我现有的应用程序结合起来。 I tested it locally and it runs/builds fine, but heroku gives me the following errors: 我在本地测试它并运行/构建正常,但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

Here's what I have unsuccessfully tried: -restarting heroku -verifying that the port is dynamically installed 这是我尝试过的失败:-restarting heroku - 验证端口是否动态安装

Any suggestions? 有什么建议?

You've got a R10 error during boot : Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 您在启动期间遇到R10错误:错误R10(启动超时) - > Web进程在启动后60秒内无法绑定到$ PORT

You should have forgot to bind your server to the environment variable named PORT . 您应该忘记将服务器绑定到名为PORT的环境变量。 You must have the following line from ReactGo boilerplate somewhere : app.set('port', (process.env.PORT || 3000)); 您必须从ReactGo样板文件中获得以下行: app.set('port', (process.env.PORT || 3000)); or more straightforward : app.listen(process.env.PORT || 3000); 或更直接: app.listen(process.env.PORT || 3000);

OR 要么

The build process took more than 60s to finish which cause your dyno to terminate before your app is builded. 构建过程需要60多秒才能完成,这会导致您的dyno在构建应用程序之前终止。 You need to use a dedicated CI tool like CircleCI (which provide a connector to Heroku) to build your application, then launch it on heroku. 您需要使用专门的CI工具,如CircleCI(提供Heroku的连接器)来构建您的应用程序,然后在heroku上启动它。

The R14 is not a critical error in Heroku but will degrade your performance. R14不是Heroku中的严重错误,但会降低您的性能。 If you use Heroku as a continuous integration plateform (as I seen in your logs) this could easly happen during build time. 如果你使用Heroku作为持续集成平台(正如我在你的日志中看到的那样),这在构建期间很容易发生。

You are getting "Error R14 (Memory quota exceeded)". 您收到“错误R14(超出内存配额)”。 Check R14 - Memory Quota Exceeded to see some possible tips. 检查R14 - 超出内存配额以查看一些可能的提示。 Perhaps you have packed in too much functionality into a single dyno? 也许你在一个dyno中包含了太多的功能? What does your Procfile look like, and what dyno types are you using? 您的Procfile是什么样的,以及您使用的是哪些dyno类型?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM