【问题标题】:heroku getting started "Deploy the App" but get app errorheroku 开始“部署应用程序”但出现应用程序错误
【发布时间】:2026-02-04 14:50:01
【问题描述】:

我正在阅读“Heroku 上的 Ruby 入门”说明。

https://devcenter.heroku.com/articles/getting-started-with-ruby#deploy-the-app

一步一步来。我在“部署应用程序”。我已经执行了heroku ps:scale web=1 命令。我没有对标准默认示例应用程序进行任何更改。

但是当我打开应用程序时,它会显示Application Error... check the logs

在日志中,我看到以下几行:

2015-01-24T07:55:37.733478+00:00 heroku[web.1]: Starting process with command bundle exec puma -t 5:5 -P ${PORT:-3000} -e ${RACK_ENV:-development}
2015-01-24T07:55:40.024681+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/puma-2.9.1/lib/puma/cli.rb:294:in `parse_options': invalid option: -P (OptionPar
ser::InvalidOption)

在我看来,用于启动 Web 服务器的 Heroku 命令不正确。据我所知,-P参数应该是小写的。

有没有办法修复这个命令?

【问题讨论】:

  • Heroku DevCenter 中的 Unicorn Web 服务器上也有文档解释了 Procfile 的概念。看看吧。

标签: ruby-on-rails heroku


【解决方案1】:

您的应用似乎未正确配置 puma 服务器。如 D-side 所示,这可能是您的 procfile 的问题。您的 procfile 应该位于应用的根目录中。

当你部署到 heroku 时,它会查看这个文件并发出命令来处理一些服务器配置。

看这里

https://devcenter.heroku.com/articles/getting-started-with-ruby#define-a-procfile

当您找到您的 procfile 后,您就可以进行任何调整。他们举了一个例子。

web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

【讨论】:

  • 是的!我认为我的问题的根源在于我有 Bitnami 堆栈,并且我正在从我的 Bitnami 控制台中浏览 Heroku 入门指南。我通过打开“普通”Windows cmd 提示符并逐步运行教程解决了这个问题。我的应用现在可以运行了。