Javier Ng Javier Ng - 1 year ago 70
Ruby Question

Gemfile ROR version and local machine ROR version mismatch

I am a complete beginner to ROR and heroku. Currently I am trying to create an app with a git from bitbucket and my gemfile version (2.2.3) is different from my ruby on rails version of 2.3.1.

What are the steps I can take to ensure that my gemfile can be changed?

This mismatch in gemfile caused my "git push heroku master" to fail with the following errors.

An error occurred while installing mime-types (3.0), and Bundler cannot

Thank you so much! (:

Answer Source

Ruby 2.3 is kind of cool - stuff like the safe navigation operator, so I recommend installing it, but if you don't want to -

In either your Gemfile or .ruby-version file, you'll probably have a line which says ruby 2.3.1. Temporarily change this to your installed version, 2.2.3.

The run bundle, or perhaps bundle --without production if you want to skip the gems marked as belonging to the production group only. For example, if you don't have postgres installed locally.

Then switch back your Gemfile or .ruby-version to 2.3.1. Commit and try and push.

What does this accomplish? It keeps the ruby version pinned at 2.3 for heroku, but installs a Gemfile.lock using your installed version. Heroku requires a Gemfile.lock for development gems only, as far as I'm aware.

By the way, I'm assuming you're using ruby version 2.2.3 and not that Rails version. The current Rails version is 4.x.x or 5.x.x. To run Rails 2.x.x, you'll probably need to downgrade to Ruby 1.8.7 or something.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download