MacOSX上的Ruby依赖问题

时间:2014-11-27 17:39:01

标签: ruby macos rvm

我试图开始使用优秀的投放工具(https://github.com/KrauseFx/deliver),但我对红宝石一无所知。因此,当我尝试运行交付初始化并收到此消息时,我不知道该怎么做:

/Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:2052:in `raise_if_conflicts': can't activate json-1.6.8, already activated json-1.8.1 (Gem::LoadError)
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1262:in `activate'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:96:in `block in require'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:95:in `each'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:95:in `require'
from /Users/sarbogast/.rvm/gems/ruby-2.1.0@global/gems/deliver-0.3.6/lib/deliver.rb:1:in `<top (required)>'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/sarbogast/.rvm/gems/ruby-2.1.0@global/gems/deliver-0.3.6/bin/deliver:5:in `<top (required)>'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/bin/deliver:23:in `load'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/bin/deliver:23:in `<main>'
from /Users/sarbogast/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/sarbogast/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'

我该怎么办?顺便说一下,我在MacOSX Yosemite上。

2 个答案:

答案 0 :(得分:2)

如果你正在使用bundler并且你有一个Gemfile,你可以尝试使用bundle运行它:

bundle exec deliver init

通过这种方式,Gemfile将为您挑选正确版本的json gem。

如果您没有使用bundler,则应使用以下命令卸载较新版本的json:

gem uninstall json

并选择1.8.1进行卸载。然后,您可以尝试再次运行deliver init

答案 1 :(得分:0)

事实上,我所要做的就是用&#34; sudo gem install json&#34;安装json。它解决了我的问题。