Bundler could not find compatible versions for gem “bundler”:

前端 未结 7 886
一向
一向 2020-12-15 04:37

Complete new person to Ruby and Rails here... Have tried some tutorials in the past, but that\'s about it. I\'m trying to follow \'Ruby on Rails 3 Tutorial\' book and have

相关标签:
7条回答
  • 2020-12-15 05:07

    First verify your versions to be sure they're all current:

    $ ruby -v
    ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
    
    $ rails -v          
    Rails 3.2.2
    
    $ gem list bundler
    *** LOCAL GEMS ***
    bundler (1.1.3)
    

    If you need to update ruby, you can download it from https://www.ruby-lang.org or use tools like ruby-build. If you have any version of Ruby 1.9.3 that's fine for now.

    To update all your gems:

    gem update --system
    gem update
    

    Gem may install gems in a few different places, and these can interfere with each other. There are system gems (typically installed by root or by using sudo) and your personal user gems. My favorite way to manage these is with a simple tool called rbenv. A related tool is rvm. Either is fine.

    For your first tutorial, you can skip using version numbers in your Gemfile:

    - gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
    + gem 'sqlite3-ruby', :require => 'sqlite3'
    

    Bundler will sort everything out the right way. Eventually you'll want to specify version numbers if you're coordinating with other developers, or building production systems.

    Feel free to ask questions here and I'll add to this answer.

    0 讨论(0)
  • 2020-12-15 05:13

    You can use latest version of Rails 3.0 (3.0.12). It supports latest bundler, and isn't fundamentally differ from 3.0.1

    0 讨论(0)
  • 2020-12-15 05:19

    Maybe you had bundler 1.1.2 AND 1.1.3 installed on your machine (and possibly more versions)

    use

    gem list bundler
    

    to check which version(s) of bundler you have installed.

    Then remove the ones you don't want with

    gem uninstall bundler -v VERSION_NUMBER
    
    0 讨论(0)
  • 2020-12-15 05:20

    it is because gems are also installed in global gemset, and you can uninstall it using:

    rvm @global do gem uninstall bundler
    

    but you can also use the other version of bundler using:

    gem install bundler -v '~>1.0.0'
    bundle _1.0.0_ install
    

    replace 1.0.0 with the version that got installed (if other)

    0 讨论(0)
  • 2020-12-15 05:27

    I had this problem and the source was a version specification for bundler in the .gemspec file:

    spec.add_development_dependency "bundler", "~> 1.16"
    

    Removing the version number solved the issue:

    spec.add_development_dependency "bundler"
    
    0 讨论(0)
  • 2020-12-15 05:31

    Sometimes to fix the issue mentioned in the title of this question it is enough to delete Gemfile.lock and run bundle update. I hope it will be helpful for someone.

    0 讨论(0)
提交回复
热议问题