捆绑包安装不适用于捆绑器 2.0.1 的 rails-4.2.6

Bundle install do not work for rails-4.2.6 for bundler 2.0.1

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.

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

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

安装任何版本为 (< 2.0, >= 1.3.0) 的捆绑器。

例如

gem install bundler -v 1.17.3

然后

bundle _1.17.3_ install

它应该适合您的情况。