Rails:由于旧的Rails版本(3.2)

时间:2019-03-02 01:58:51

标签: ruby-on-rails ruby rubygems bundler

我最近有一个旧的Rails应用程序,试图通过bundle install安装gems。但是它不断提醒我:

  

捆绑器找不到与宝石“捆绑器”兼容的版本:在Gemfile:rails(〜> 3.2)已解析为3.2.22.5,这取决于捆绑器(〜> 1.0)

经过Google的一些搜索后,我知道Rails 3.2将bundler版本冻结为1.0。所以我通过执行`gem uninstall bundler -v 2.0.1 and install bundler 1.0.10 gem install bundler -v 1.0.10`来卸载了当前的bundler(2.0.1),但是又发生了另一个错误:

  

/home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3:in {{1} }针对Gem:Module的“ source_index”(NoMethodError)   你的意思是?资料来源       来自/home/alec/.rbenv/versions/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:<top (required)>': undefined method中要求'       来自/home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler.rb:195:在require' from /home/alec/.rbenv/versions/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in根目录下       来自/home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler.rb:171:在default_gemfile' from /home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler.rb:165:in设置中       来自/home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler/cli.rb:222:在app_config_path' from /home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler.rb:183:in中运行'       来自/home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in {{ 1}}调度”       来自/home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in {{ 1}}'       来自/home/alec/.rbenv/versions/2.3.7/bin/bundle:22:in install' from /home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in'

顺便说一句,我的Gemfile:

invoke_task'
      from /home/alec/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in

我到处搜索过,但没什么用。任何帮助将不胜感激!谢谢。

1 个答案:

答案 0 :(得分:2)

bundlerrubygems的旧版本之间似乎有些不兼容。

我能够通过更新Gemfile成功安装您的bundler(在此代码段中,我将其更新为最新的可用v1):

$ gem uninstall bundler
$ gem install bundler -v '~>1'
$ bundle install