Spork与bundle exec的错误? [英] Spork error with bundle exec?

查看:115
本文介绍了Spork与bundle exec的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <$ c $  c>你已经激活了spork 0.9.0.rc8,但是你的Gemfile需要spork 0.8.5。考虑使用bundle exec。 (Gem :: LoadError)

我的gemfile:

  group:development,:test do 
gemrspec
gemrspec-rails
gemfactory_girl_rails
gem 'spork'
gem'webrat'
gem'awesome_print'

gem'vcr'
gem'fakeweb'
end

我已经运行了 bundle update gem update 甚至 gem update --system 但我仍然看到这个错误。运行 bundle exec spork 可以工作,但我想知道为什么 spork 不是,我可以如何解决这个问题。

解决方案

也许你的问题已经解决了(我会假设),但是最近几天我遇到了类似的问题,这个错误的原因。它与使用捆绑器时所有需要的gem版本相关。当仅提供 spork 时, RubyGems 会被激活并寻找合适的版本。但是这会绕过捆绑器将使用的 Gemfile 中指定的版本。只有在使用 bundle exec spork 时,打包程序才能从 Gemfile 中查找版本。在你的情况下, spork 指向已安装的版本为' 0.9.0 '的gem,而 bundle exec spork uses' 0.8.5 '。
有一个可用的标志(bundle exec --binstubs),它创建一个 bin 文件夹(> = bundler 1.0),并将所有可执行文件将Gemfile放入它。不要使用bundle exec spork,而是写 bin / spork



搜索Gem Versioning and Bundler:Doing It Rightby Yehuda Katz ,它更详细地解释了一切,帮助了我很多。


Whenever I run spork, I am getting the following error:

You have already activated spork 0.9.0.rc8, but your Gemfile requires spork 0.8.5. Consider using bundle exec. (Gem::LoadError)

my gemfile:

group :development, :test do
    gem "rspec"
    gem "rspec-rails"
    gem "factory_girl_rails"
    gem 'spork' 
    gem 'webrat'
    gem 'awesome_print'

    gem 'vcr'
    gem 'fakeweb'
end

I have ran bundle update and gem update and even gem update --system but I am still seeing this error. running bundle exec spork works, but I want to know why spork doesn't and how I can fix this.

解决方案

Maybe your problem is already solved (I would assume), but I faced a similar problem the last few days and found the reason for this error. It has to do with the versioning of all needed gems when using bundler. When only "spork" is provided then RubyGems gets activated and looks for an appropriate version. But this bypasses the specified version from the Gemfile that the bundler would use. Only when "bundle exec spork" is used, the bundler can look up the version from the Gemfile. In your case "spork" points to an installed gem with version '0.9.0', while "bundle exec spork" uses '0.8.5'. There is a flag available ("bundle exec --binstubs") that creates a "bin" folder (>= bundler 1.0) and puts all executables specified by the Gemfile into it. Instead of "bundle exec spork" it is valid to write "bin/spork".

Search for "Gem Versioning and Bundler: Doing it Right" by Yehuda Katz, it explains everything in more detail and helped me a lot.

这篇关于Spork与bundle exec的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆