上架失败。要求 Sinatra 失败

Rackup Fails. Require Sinatra Fails

我是 运行 rackup config.ru

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

哪个returns:

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 输出也是:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.3
  - RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [x86_64-darwin18]
  - INSTALLATION DIRECTORY: /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3

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

我做错了什么?

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

运行:

$ gem install sinatra -v 2.0.7