Search code examples
ruby-on-railsrubyrubygemsbundler

How to downgrande a gem in the gemfile?


I have this in my Gemfile.lock

 sequel (5.15.0)

I want to downgrade the gem version to the 4.39.0 so I go in my Gemfile and add a version next to the gem declaration:

gem 'sequel', '4.39.0'

and run bundle exec bundle install

But it gives me:

You have requested:
  sequel = 4.39.0

The bundle currently has sequel locked at 5.15.0.
Try running `bundle update sequel`

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
Run `bundle install` to install missing gems

. So I try to run bundle exec bundle update sequel but it returns me the same message. How can I downgrade the gem?


Solution

  • You need to just call

    bundle update sequel
    

    without the bundle exec in front.

    The issue you experienced is caused by bundle exec evaluating your current Gemfile for executing the latter command first. Here, it finds the difference between the specified gems in the Gemfile and your current Gemfile.lock and bails out.

    In general, no bundle calls need to ever be prefixed with a bundle exec.