我正在尝试创建一个简单的Sinatra应用程序。我想使用Sinatra-Authentication添加用户身份验证。我一直在使用他们的github site和blog。我使用了东京-Rufus的第二个例子。
但是,现在当我尝试使用 foreman start 启动我的应用时,我收到以下错误:
foreman start
23:42:30 web.1 | started with pid 6394
23:42:30 web.1 | web.rb:2:in `require': cannot load such file -- rufus_tokyo (LoadError)
23:42:30 web.1 | from web.rb:2:in `<main>'
23:42:30 web.1 | exited with code 1
23:42:30 system | sending SIGTERM to all processes
SIGTERM received
我的web.rb看起来像这样(按照他们的github网站上的说明):
require 'sinatra'
require "rufus_tokyo"
require "digest/sha1"
require 'rack-flash'
require "sinatra-authentication"
TcUserTable.cabinet_path = File.dirname(__FILE__) + 'db'
use Rack::Session::Cookie, :secret => 'A secret cookie'
use Rack::Flash
get '/' do
erb :index
end
因此很明显它在尝试加载rufus-tokyo gem时失败了。但是当我做一个捆绑列表时,我得到了:
Gems included by the bundle:
* rufus-tokyo (1.0.7)
......所以它应该被包括在内。我正在使用Ruby 2.0并在Ruby 2.0.0 cannot load such file even though gem is installed上看到他们使用的是错误版本的ruby ...但当我 ruby -v 时,我得到了
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin13.2.0]
所以我认为我也在使用正确版本的Ruby。关于我为什么会收到这个错误的任何想法都将非常感激。感谢。