【问题标题】:Bundler: assembling the proper Gemfile / "Bundler could not find compatible versions for gem bundler"Bundler:组装正确的 Gemfile /“Bundler 找不到 gem bundler 的兼容版本”
【发布时间】:2012-09-27 21:04:49
【问题描述】:

here 提出了同样的问题,但没有一个适合我的答案。

我对 Ruby/Rails/RVM/Bundler/Gemfile/etc 完全陌生。我正在关注 Hertl 的 Rails 3 教程。我遇到了与上面链接中所述相同的问题:Bundler 找不到 gem bundler 的兼容版本。

当我运行“$ bundle install”时,我收到以下消息:

Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) ruby depends on
  bundler (~> 1.0.0) ruby

Current Bundler version:
bundler (1.2.1)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

我不知道从这里去哪里。我已经尝试过 Hertl 关于指定特定 Bundler 版本的建议——他建议尝试 1.2.5 或 1.3.1,无论哪个可行——但即使指定特定版本的 Bundler,我也会遇到同样的错误。

我真的不知道从哪里开始,并且对缺乏清晰度感到沮丧。一个简单的图表可以帮助我理解这些不同的实用程序之间的关系;否则我只是在黑暗中拍摄。一个有助于将 Rails 运行所需的不同组件联系起来的答案会很棒!

有人有好的建议吗?

【问题讨论】:

    标签: bundler gemfile


    【解决方案1】:

    关键是Rails 3.0.1Bundler (~> 1.0.0) 的依赖。此表示法意味着您可以使用 1.0.0 中的 bundler 版本,但低于 1.1.0 - 当您尝试使用 1.2.1 时会出现错误。

    最简单的解决方法是卸载 bundler 1.2.1 并安装 bundler 1.0.22,这是与您正在使用的 Rails 版本兼容的最后一个版本。

    gem uninstall bundler
    gem install bundler -v1.0.22
    

    这将解决您的问题,但如果您按照 Hartl 的教程进行操作,您可能会遇到其他问题,因为在提出此问题时,该教程使用 Rails v3.2.8。您有什么理由使用3.0.1 而不是3.2.8?我的建议是使用教程使用的版本,否则您可能会遇到难以诊断的错误。

    如果您可以转到Rails 3.2.8,那么您的问题也将得到解决,因为bundler 1.2.1Rails 3.2.8 兼容。

    【讨论】:

    • 我刚才也遇到了同样的问题。我想我们都有本教程的打印副本,它使用了 Rails 3.0.1。
    猜你喜欢
    • 2019-12-01
    • 2022-08-14
    • 2011-10-31
    • 2017-07-17
    • 2018-02-09
    • 2014-05-26
    • 2014-03-14
    • 2013-03-13
    • 2019-05-07
    相关资源
    最近更新 更多