Sinatra错误:无法激活sinatra-contrib-1.4.2

时间:2015-04-02 19:38:42

标签: ruby rubygems sinatra sinatra-activerecord

尝试运行Sinatra应用程序并且我一直收到此错误:

/Users/matthewsmith/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:2064:in `raise_if_conflicts': 
Unable to activate sinatra-contrib-1.4.2, because tilt-2.0.1 conflicts with tilt (~> 1.3) (Gem::LoadError)
from /Users/matthewsmith/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:1262:in `activate'
from /Users/matthewsmith/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems.rb:196:in `rescue in try_activate'
from /Users/matthewsmith/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems.rb:193:in `try_activate'
from /Users/matthewsmith/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /Users/matthewsmith/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from app.rb:3:in `<main>'

这是我的Gemfile:

gem 'sinatra', '~> 1.4.5'
gem 'activerecord'
gem 'pg'

我试过包括

gem 'tilt', '~> 1.3' 

在Gemfile中也是如此,但是没有用 有什么想法吗?

2 个答案:

答案 0 :(得分:4)

我遇到了同样的问题。我删除了Tilt 2.0.1,我的应用程序按预期工作。

删除gem:

$ gem uninstall tilt -v 2.0.1
Successfully uninstalled tilt-2.0.1

$ bundle install
Resolving dependencies...
...
Bundle complete! 9 Gemfile dependencies, 17 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

重新启动的应用程序(通过Pow):

~/app-dir$ touch tmp/restart.txt

答案 1 :(得分:2)

在我的Gemfile中指定:

gem 'sinatra-contrib', github: 'sinatra/sinatra-contrib'

并正在运行

bundle update

为我修好了。