Search code examples
rubyinstallationbundlerrbenv

Bundler conflict requirements for the Ruby version


I installed the rbenv but when try to execute this command bundle install --path vendor/bundle I got an error.

Error:

  Bundler found conflicting requirements for the Ruby version:
  In Gemfile:
    Ruby (~> 2.3.7.0)

    github-pages (~> 212) was resolved to 212, which depends on
      jekyll-feed (= 0.15.1) was resolved to 0.15.1, which depends on
        Ruby (>= 2.4.0)

How do I fix this?


Solution

  • As mentioned in the comments the error is saying you have 2 options, upgrade ruby to a higher version or downgrade the github pages, you mentioned you are using rbenv which is very useful for this scenario. All you need to do is upgrade your ruby version. Go to your project folder and open a terminal then you can do something as follow:

    rbenv install x.y.z, where x.y.z is the ruby version you want to install (e.g. 2.4.0), after that all you need to do is specify which version of ruby do you want to use in that project, so in the same terminal run: rbenv local x.y.z. That's it you should be able to run bundle install.

    A couple of notes:

    • Remember to update your gemfile with the proper ruby version (after upgrade)

    • If you want to install your gems in a particular path and you are using bundle >= 2 (to check gem version: gem list | grep bundle), you should use a configuration file instead of specify the path in the command. Create a .bundle folder in your root directory and add a file called config, then in such file add the path (e.g. BUNDLE_PATH: ./vendor/bundle)