如何在Mac上解决涉及rake的ruby gem冲突?

时间:2015-07-23 20:56:15

标签: ruby macos gem

我试图在Mac OSX下运行rake,我收到以下错误。

$ rake --trace
rake aborted!
Gem::ConflictError: Unable to activate releasy-0.2.2, because rake-10.3.2 conflicts with rake (~> 0.9.2.2)
/Library/Ruby/Site/2.0.0/rubygems/specification.rb:2112:in `raise_if_conflicts'
/Library/Ruby/Site/2.0.0/rubygems/specification.rb:1280:in `activate'
/Library/Ruby/Site/2.0.0/rubygems.rb:198:in `rescue in try_activate'
/Library/Ruby/Site/2.0.0/rubygems.rb:195:in `try_activate'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require'
/Users/Development/RUBY/rakefile:5:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/usr/bin/rake:23:in `load'
/usr/bin/rake:23:in `<main>'

宝石列表 - 本地显示

rake(10.3.2,0.9.6,0.9.2.2)

我如何解决我安装的rake gem和使用OSX部署的rake gem之间的冲突?我应该删除最新的更新,还是有办法在我的rake文件中指定使用最新版本并忽略冲突?

1 个答案:

答案 0 :(得分:2)

如果您尝试在使用rake的项目中运行Gemfile,请尝试以下操作:

bundle exec rake --trace

这将加载项目所需的rake版本,而不是可能发生冲突的版本(如OSX默认/ usr / bin / rake二进制文件)。

如果找不到bundle命令,请执行以下操作:

gem install bundler

此外,如果这是最近的Rails应用程序,您也可以使用提供的binstubs,如下所示:

bin/rake --trace

如果这些都不起作用,请尝试使用RVMChrubyRBEnv来管理您的Ruby环境,与操作系统提供的Ruby分开管理。