从2.3切换到2.4时,套件更新错误

时间:2019-02-20 05:59:03

标签: ruby-on-rails bundler rbenv gemfile

我正在尝试从Ruby 2.3迁移到2.4.2,并将monogID 5.0迁移到5.2

我收到软件包更新错误。

我正在使用rbenv并在本地安装并设置2.4.2。

然后我不得不运行gem install bundler->它安装了2.0.1

然后我运行捆绑包更新,但出现此错误。

      Bundler could not find compatible versions for gem "bundler":
    In Gemfile:
      iron_worker_ng was resolved to 1.6.10, which depends on
        bundler

      rails (~> 4.2) was resolved to 4.2.11, 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)', in any of the sources.

  Bundler could not find compatible versions for gem "mongoid":
    In Gemfile:
      mongoid (~> 5.2)

      mongoid-encrypted-fields was resolved to 1.2.2, which depends on
        mongoid

我不确定该如何解决?

1 个答案:

答案 0 :(得分:1)

您需要做的第一件事是安装兼容版本的捆绑器

gem install bundler -v '~> 1.17'
  

rails(〜> 4.2)已解析为4.2.11,具体取决于
         捆绑软件(<2.0,> = 1.3.0)

好像您使用的是rails 4.2一样,它需要使用旧版本的捆绑器

然后运行

bundle install

,您还需要解决其他一些依赖性