机架失败。需要Sinatra失败

时间:2019-11-28 12:50:18

标签: ruby sinatra rackup

我正在运行<select name="id_kategori" id="id_kategori" class="form-control"> <option selected>kategori</option> <?php foreach($kategori as $item){ <--edit echo '<option value='.$item['id_kategori'].'>'.$item['kategori'].'</option>'; }?> </select>

config.ru文件包含:

rackup config.ru

哪个返回:

require 'sinatra'
require 'sinatra/base'

app = ->(env){

   status = 200
   headers = {"content-type" => "text/html"}
   body = ["<Html><Body><H1>Hello, World!</H1></Body></Html>"]

   [status, headers, body]

}

run app

我的Exception `LoadError' at /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3/gems/sinatra-base-1.0/lib/sinatra/showexceptions.rb:1 - cannot load such file -- rack/showexceptions Exception `LoadError' at /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3/gems/sinatra-base-1.0/lib/sinatra/base.rb:6 - cannot load such file -- rack/showexceptions Exception `LoadError' at /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3/gems/sinatra-base-1.0/lib/sinatra.rb:4 - cannot load such file -- rack/showexceptions Exception `LoadError' at /Users/konstantinosschoinas/Desktop/projects/bookstore-api/config.ru:1 - cannot load such file -- rack/showexceptions Exception `LoadError' at /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3/bin/rackup:23 - cannot load such file -- rack/showexceptions 输出是:

gem env

我用gem安装了Sinatra和Sinatra :: Base。

我在做什么错了?

1 个答案:

答案 0 :(得分:1)

您需要将Sinatra gem更新为sinatra-2.0.7

运行:

$ gem install sinatra -v 2.0.7