I'm a Rails newb who's trying out Rails on a DigitalOcean droplet. The installations seemed to work fine, but I'm getting a curious error message when I try to generate a scaffold:
DO 10:48 Rails/simple (master) → rails generate scaffold User name:string email:string
Traceback (most recent call last):
5: from bin/rails:3:in `<main>'
4: from bin/rails:3:in `load'
3: from /home/tony/rails/simple/bin/spring:10:in `<top (required)>'
2: from /home/tony/rails/simple/bin/spring:10:in `new'
1: from /home/tony/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/lockfile_parser.rb:95:in `initialize'
/home/tony/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version': You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)
DO 10:49 Rails/simple (master) → bundle list bundler
/home/tony/.rvm/gems/ruby-2.6.0/gems/bundler-2.0.1
DO 10:50 Rails/simple (master) → gem list bundler
*** LOCAL GEMS ***
bundler (2.0.1, default: 1.17.2)
bundler-unload (1.0.2)
rubygems-bundler (1.4.5)
I.e., the current Bundler gem is version 2.0.1, but Rails still thinks it's insufficient.
I can't find anything similar on the web. The only red flag I can see is that the bundler gem shows a default version of 1.17.2. How do I begin to diagnose the problem?
Installing Bundler 2 The first step in upgrading to Bundler 2 is installing the Bundler 2 gem. To install it the usual way, run gem install bundler and RubyGems will install the latest version of Bundler.
gem env – try to search in provided list under GEM PATHS, in specifications/default. remove there bundler-VERSION. gemspec. install bundler, if you don't have specific: gem install bundler:VERSION --default.
You must use Bundler 2 or greater with this lockfile. The issue was with gemfile.lock because my local bundle version and project bundle version was not matching! Here is solution- That solved my problem, it is smooth! Hope will work for others! Show activity on this post.
Using bundler 2.0.1 allows for automatic version switching as required by the lock file. In this regard, installing bundler 2.0.1 worked for me. Show activity on this post. I had the same problem today.
This repository has been archived by the owner. It is now read-only. After installing Bundler following the steps from this page, I cannot seem to run a test in rails.
Heroku does not use Bundler 2.0, but 1.15.2, as the tracelog hints. As far as I am aware, the "workaround" is to create your own buildpack, or simple fork their own:
This helped me: gem update --system
I ran into the same issue & resolved it by downgrading with gem uninstall bundler
, followed by gem install bundler -v 1.17.3
to revert back to the last pre 2 version.
I saw this across 3 separate systems using different version managers (ASDF, rbenv, rvm) and this resolved the issue.
There is some information on getting both versions to play nicely here. The root cause of this issue may have been a bug (which appears to have since been fixed)
Per the comment from @MatijsvanZuijlen below, and the bundler documentation, you should also be able to specify which version of bundler you want to use at runtime with bundle _1.17.3_ install
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