【发布时间】:2021-01-30 20:10:30
【问题描述】:
我的 Sinatra 应用程序非常简单。
Config.ru
require './hello_app'
run Sinatra::Application
宝石文件
source 'https://rubygems.org'
ruby "2.6.6"
gem 'sinatra'
hello_app.rb
require 'sinatra'
get '/' do
"Hello World!"
end
此应用可在本地运行。但是,当我尝试部署到 Heroku 时,出现以下错误:
2020-12-27T23:29:11.036031+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-27T23:29:12.572800+00:00 heroku[web.1]: Starting process with command `APP_ENV=production bundle exec rackup -p "57643"`
2020-12-27T23:29:16.071115+00:00 app[web.1]: [heroku-exec] Starting
2020-12-27T23:29:16.663254+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.6.0/bin/rackup)
2020-12-27T23:29:16.663275+00:00 app[web.1]: Gem::Exception: can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?
2020-12-27T23:29:16.663276+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/rubygems_integration.rb:374:in `block in replace_bin_path'
2020-12-27T23:29:16.663277+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/rubygems_integration.rb:402:in `block in replace_bin_path'
2020-12-27T23:29:16.663277+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/bin/rackup:23:in `<top (required)>'
2020-12-27T23:29:16.722478+00:00 heroku[web.1]: Process exited with status 1
2020-12-27T23:29:16.770208+00:00 heroku[web.1]: State changed from starting to crashed
我尝试了其他线程中提供的许多建议,例如添加 Procfile 等,但每次都会遇到相同的错误。我是一个新的学习者,我已经走到了死胡同。关于如何继续前进的任何想法?
【问题讨论】:
-
@AlterLagos 我在那里尝试了所有建议。不幸的是没有帮助;这是同样的问题。
-
您可能只是缺少将
gem 'rack'添加到您的Gemfile 相关错误是Gem::Exception: can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?