I am trying to run an app taken off Github.
I have run bundle install
to install required gems from the Gemfile
. However when running the app, an error message tells me the gems installed are the wrong version.
On inspecting the Gemfile.lock
I note that the versions are older than the gems installed. (i.e. I have newer versions of gems installed and the application requires older gems.)
Is there a quick way to install all the gems as per the versions described in the Gemfile.lock file? Alternatively is there a method to ignore that file?
Gemfile:
source 'http://rubygems.org'
gem 'rails', "3.0.9"
gem "sass"
..
Gemfile.lock:
sass (3.1.1)
..
In the above example, even though sass is installed the app specially requires version 3.1.1.
With a valid Gemfile.lock
file, bundle install
alone should be sufficient, unless some particular gem version has been yanked. In that case you would need to look for an alternative gem version that is still currently available (usually bundle update name_of_yanked_gem
would suffice).
About the sass 3.1.1
, it is not so much that the application requires that particular version, but rather, that was likely the newest version available when the Gemfile.lock
was last generated/updated given the overall version constraints as specified in Gemfile
. As you have listed, there is no version range specified for sass
itself, but other gems may impose further constraints if they have sass
as a dependency.
Outright ignoring Gemfile.lock
is not a good idea as under normal circumstances it will be specifying the gem versions that were last known to be still usable with the application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With