0

When I run rails console in my production server with this command

rails c

I get this message:

You must use Bundler 2 or greater with this lockfile.

I checked bundler version:

gem list bundler

And I got this

bundler (2.0.2, default: 1.17.3, 1.16.3)
bundler-unload (1.0.2)
rubygems-bundler (1.4.4)

I read I could set bundler version with this command

bundle _2.0.2_ -v

And I got this message

Bundler version 2.0.2

But I keep getting the same error when running rails console.

Finally, some more information. My Gemfile.lock says I bundled with v2.0.1 (development bundler version). I'm using rvm in production and rbenv in development (not on purpose; I always used rbenv but I inherited an application using rvm in production).

What should I do to run rails console in production server in this situation? Can I uninstall older bundler versions and keep only v2.0.2? Should I updgrade to v2.0.2 in development to have the same versions?

Thanks!

Pablo
  • 3,004
  • 1
  • 12
  • 19
  • What does `which rails` resolve to on the server? I would try `bundle exec rails` as a first step; the shell's PATH might be pointing to a system Ruby. – Robert Nubel Sep 05 '19 at 13:33
  • `/usr/share/rvm/gems/ruby-2.3.1@xxx/bin/rails`. (xxx is the name of a gemset). I tried `bundle exec rails c` with the same result. – Pablo Sep 05 '19 at 13:53
  • I don't hink `bundle _2.0.2_ -v` sets which version to use as default, try `bundle _2.0.2_ exec rails c` or check this question to change the default gem version https://stackoverflow.com/questions/42548445/how-to-make-a-specific-gem-version-as-default – arieljuod Sep 05 '19 at 14:58
  • There are a few solutions to the problem outlined in https://stackoverflow.com/questions/54063318/bundler-2-0-1-installed-rails-says-must-use-bundler-2-or-greater, but none of them provide much insight into the root cause. – Robert Nubel Sep 05 '19 at 15:18

0 Answers0