如何降级捆绑器或升级导轨?


77

我将omniauth gem添加到我的gemfile中,并尝试运行bundle install,但收到有关Rails和bundler版本不兼容的消息。我尝试更新导轨,但收到有关与其他宝石不兼容的消息。如何将捆绑器降级到1.0?

$ bundle install
Fetching gem metadata from http://rubygems.org/......
Fetching gem metadata from http://rubygems.org/..
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 3.0.0) ruby depends on
      bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.1.1)

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

$ bundle update rails
Fetching gem metadata from http://rubygems.org/......
Fetching gem metadata from http://rubygems.org/..
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    factory_girl_rails (>= 0) ruby depends on
      bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.1.1)

Answers:



20

要安装捆绑器的降级版本,请尝试:

gem install bundler --version '<= 0.10.6'

因此您可以同时安装两个版本(检查:gem list bundler/ bundler _0.9.26_ -v),然后使用该特定版本运行,例如:

bundle _0.9.26_ install

了解更多信息:如何在rubyforge上升级/降级Rubygems


2

要降级,只需键入gem uninstall bundler它将显示:

Select gem to uninstall:
 1. bundler-1.13.7
 2. bundler-1.14.4
 3. bundler-1.16.4
 4. bundler-2.0.2
 5. All versions

只需选择要卸载的版本。


2

如果您想降级或升级您的产品,bundler 则在我们尝试卸载全局捆绑程序版本时会遇到一些问题。我用自己的技术解决了这个问题。按照步骤:

步骤1:执行:gem list bundler

*** LOCAL GEMS ***
bundler (2.0.2, 1.17.3)
bundler-unload (1.0.2)
rubygems-bundler (1.4.4)

我在这里有2个Bundle版本2.0.2和1.17.3。现在,我将卸载2.0.2,因为我将使用1.17.3。但是,当我尝试使用此命令卸载2.0.2时,gem uninstall bundler --version '2.0.2'发现一个错误:

ERROR:  While executing gem ... (Gem::InstallError)
bundler is not installed in GEM_HOME, try:
    gem uninstall -i /home/habib/.rvm/gems/ruby-2.3.1@global bundler

因为这是我的全球打包机。但是错误消息有解决方法。然后我尝试第2步。

步骤2:执行gem uninstall -i /home/habib/.rvm/gems/ruby-2.3.1@global bundler

输出: Successfully uninstalled bundler-2.0.2

步骤3:我再次检查我的捆绑器列表gem list bundler

*** LOCAL GEMS ***

bundler (1.17.3)
bundler-unload (1.0.2)
capistrano-bundler (1.2.0)
rubygems-bundler (1.4.4)

在这里,我只有一个捆绑器1.17.3,可以在任何项目中使用它

检查您的捆绑器版本:运行 bundler -v

output: Bundler version 1.17.3


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.