Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby heroku捆绑程序:未能加载命令:rackup_Ruby_Heroku_Sinatra - Fatal编程技术网

Ruby heroku捆绑程序:未能加载命令:rackup

Ruby heroku捆绑程序:未能加载命令:rackup,ruby,heroku,sinatra,Ruby,Heroku,Sinatra,我正在尝试向heroku部署一个模块化的sinatra应用程序,它在本地运行良好。这在heroku日志中: 2020-12-28T21:05:15.907560+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 58645` 2020-12-28T21:05:18.738254+00:00 app[web.1]: bundler: failed to load command:

我正在尝试向heroku部署一个模块化的sinatra应用程序,它在本地运行良好。这在heroku日志中:

2020-12-28T21:05:15.907560+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 58645`
2020-12-28T21:05:18.738254+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.7.0/bin/rackup)
2020-12-28T21:05:18.738283+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?
命令
bundle exec rackup config.ru-p 58645
在本地运行良好

这是我的config.ru

require_relative './config/environment.rb'
use EntreeController
use UserController
run ApplicationController
和环境.rb

APP_ENV = ENV["RACK_ENV"] || "development"
ENV['SINATRA_ENV'] ||= "development"

require 'require_all'
require 'bundler/setup'
Bundler.require(:default, ENV['SINATRA_ENV'])

require_all 'app'
require_all 'app/models'
require_all 'app/helpers'
和proc文件:

web: bundle exec rackup config.ru -p $PORT

如果有人碰到同样的问题,我会发布我的解决方案。我遵循了
Rakefile
上的指示:

一个解决方案是在部署到Heroku时完全删除Rakefile。另一种解决方案是仅将其放入Rakefile:

require "sinatra/activerecord"
require "sinatra/activerecord/rake"
require "./app" # or whereever your app is

切换到Bundler 2.1.4解决了我的问题

从长远来看,必须安装bundler 2.1.4并使用它,但为了测试,我只是在
Gemfile.lock
中手动编辑了该行:

BUNDLED WITH
   2.1.4
我使用的是Ruby 2.7.2和Bundler 2.2.8,Heroku buildpack提供了Bundler 2.1.4

有趣的是,Heroku对2.2.8一无所知