Heroku / react / Docusaurus-错误R10(启动超时) - >网络过程未能在启动的60秒内绑定到$端口

发布于 2025-02-12 17:00:00 字数 1071 浏览 1 评论 0原文

当将相当的香草纪录库(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫性小仙女 2025-02-19 17:00:00

假设您有一个香草纪录的项目,则可以通过在procfile中包括以下内容来托管它。您可能还需要将BuildPack设置为Heroku/nodejs,但是Heroku应该为您自动发现项目类型。

web: npm run serve -- -p $PORT

为什么此操作

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 be heroku/nodejs, but Heroku should auto-discover the project type for you.

web: npm run serve -- -p $PORT

Why this Works

npm run serve runs docusaurus serve "under the hood" which starts a small Node process that serves the static files under the build directory. I assume Heroku is already correctly building your Docusaurus site - which it should since the nodejs buildpack runs npm 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 an npm argument separator where anything after the -- is passed along to the underlying command being run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文