【问题标题】:Bundle install do not work for rails-4.2.6 for bundler 2.0.1捆绑安装不适用于 bundler 2.0.1 的 rails-4.2.6
【发布时间】:2019-05-13 15:51:44
【问题描述】:

RVM 设置在 ruby-2.4.0 上,我创建了具有版本的新应用程序,

gem 'rails', '4.2.6'

我更新了捆绑器使用,

gem update --system
gem install bundler
bundle version
# Bundler version 2.0.1 (2019-01-04 commit d7ad2192f)

bundle install 时出现以下错误,

Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 4.2.6) was resolved to 4.2.6, which depends on
      bundler (< 2.0, >= 1.3.0)

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

Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails (= 4.2.6)', in any of the sources.

它要求我需要较低版本的捆绑器,为什么?上面应该怎么解决?

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-4.2 ruby-2.4


    【解决方案1】:

    安装任何版本为 (= 1.3.0) 的捆绑程序。

    例如

    gem install bundler -v 1.17.3
    

    然后

    bundle _1.17.3_ install
    

    它应该适合你的情况。

    【讨论】:

    • 删除 Gemfile.lock 是个坏主意,因为有关 gem 版本的信息将会丢失,并可能导致意外的事情发生。
    【解决方案2】:

    您的 Gemfile 指定了与 2.x.x 不兼容的旧捆绑器版本。尝试运行gem install bundler -v 1.3.0 或您在Gemfile.lock 中列出的任何版本(检查文件末尾)。

    【讨论】:

    • 已安装旧版本,但为 bundle --version 显示 2.0.1
    • 好的,您可能需要先删除较新的捆绑程序gem uninstall bundler --version 2.0.1
    • 是的,按照同样的方法工作,简单但从未尝试过的困难!谢谢:)
    • Gemfile.lock 文件中,捆绑器版本对我来说是 2.0.1,我将其更改为 1.16.1,因为我的项目确实需要它。做bundle install 它有效!
    猜你喜欢
    • 2013-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 2019-06-17
    • 2019-06-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多