Heroku / react / Docusaurus-错误R10(启动超时) - >网络过程未能在启动的60秒内绑定到$端口
当将相当的香草纪录库(React Package)部署到Heroku时,我似乎无法构建它并访问它...
我得到了这些错误:
2022-07-04T07:57:45.906918+00:00 app[web.1]: ✔ Client: Compiled successfully in 235.87ms
2022-07-04T07:57:45.909887+00:00 app[web.1]: client (webpack 5.72.0) compiled successfully
2022-07-04T07:58:32.529800+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-07-04T07:58:32.569851+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-07-04T07:58:32.590954+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2022-07-04T07:58:32.775949+00:00 heroku[web.1]: Process exited with status 22
2022-07-04T07:58:32.816768+00:00 heroku[web.1]: State changed from starting to crashed
我已经调查过这个,”人们说,Heroku港口有约束力的错误。我真的不知道这意味着什么,但是无论如何,我都不明白,因为这是一个前端应用程序,而(afaik)涉及节点JS。这是一个简单的Web应用程序,不确定为什么它不能仅仅编译...因此,据我所知,无论如何我都无处可指定一个端口。
When deploying a fairly vanilla docusaurus (React package) to Heroku, I cannot seem to build it and access it...
I get these errors:
2022-07-04T07:57:45.906918+00:00 app[web.1]: ✔ Client: Compiled successfully in 235.87ms
2022-07-04T07:57:45.909887+00:00 app[web.1]: client (webpack 5.72.0) compiled successfully
2022-07-04T07:58:32.529800+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-07-04T07:58:32.569851+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-07-04T07:58:32.590954+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2022-07-04T07:58:32.775949+00:00 heroku[web.1]: Process exited with status 22
2022-07-04T07:58:32.816768+00:00 heroku[web.1]: State changed from starting to crashed
I have looked into this, most of the time people say that there is a binding error with Heroku ports. I don't really know what that means to be honest, but in any case, I don't understand because this is a frontend app and does not (AFAIK) involve Node js. It's a simple web app, not sure why it can't just compile...as such there is nowhere for me to specify a port anyway with a React app as far as I know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您有一个香草纪录的项目,则可以通过在
procfile
中包括以下内容来托管它。您可能还需要将BuildPack设置为Heroku/nodejs
,但是Heroku应该为您自动发现项目类型。为什么此操作
npm运行服务
运行docusaurus serve
“在引擎盖下”启动了一个小节点进程,该过程在build> build> build> build> build> build
目录下提供静态文件。 。我假设Heroku已经正确构建了您的Docusaurus网站 - 它应该是因为nodejs
buildpack运行npm run bualt bualt build build
如果存在。这完全可以正确地为您的项目提供服务,以便Heroku的路由可以正确绑定到它。
-p $ port
指定我们要在Heroku表示的端口上运行Docusaurus Server,而-
是npm
参数分离器-
之后的任何内容都传递到正在运行的基础命令中。Assuming you have a vanilla-ish Docusaurus project, you can host it on Heroku by including the following in your
Procfile
. You may also need to set the buildpack to beheroku/nodejs
, but Heroku should auto-discover the project type for you.Why this Works
npm run serve
runsdocusaurus serve
"under the hood" which starts a small Node process that serves the static files under thebuild
directory. I assume Heroku is already correctly building your Docusaurus site - which it should since thenodejs
buildpack runsnpm run build
by default if present.This altogether will serve your project correctly so Heroku's routing can correctly bind to it. The
-p $PORT
specifies that we want to run the Docusaurus server at the port denoted by Heroku, and the--
is annpm
argument separator where anything after the--
is passed along to the underlying command being run.