How to change the version a gemfile.lock is bundled with

10k Views Asked by At

I had two versions of bundler installed locally 1.15.2 and 1.16.1. I had pushed my code and soon realized that the gemfile.lock BUNDLED WITH, updated the version to 1.16.1 and that is not what we want.

I then removed 1.16.1 locally and now my default is 1.15.2 which is exactly what I want and ran bundle install in the checked out branch hoping that it would update ( downgrade ) the BUNLED WITH to 1.15.2 but git diff and searching the gemfile.lock shows that nothing has changed and it still says 1.16.1.

Should I go in and manually change it which I know is never a good idea to manually edit the Gemfile.lock. Or is there a command to run that will do what I intend it to do.

Thanks

3

There are 3 best solutions below

5
On

Process: install the gem generically, looking up your target version on rubygems.org, then update and version your Gemfile.

the install command is in the right-hand column. then you can:

gem install gem_name -v 1.5.4 and see what results of dependencies et al. respecify the gem version in your gemfile (the lock file is not meant to be edited). Then bundle install for your app to be secure.

0
On

Did you try with bundle update?.

If this doesn't work go to your Gemfile.lock and change it manually.

Or delete the line and then do bundle install /update----add the gem and then do bundle install/update again.

Hope it helps

0
On

bundle update --bundler will update the BUNDLED_WITH version.