Search code examples
ruby-on-railsruby-on-rails-3ruby-on-rails-3.2bundlerrbenv

Bundler::LockfileError falsely reported


I recently began using rbenv to manage my projects, switching from rvm. It has been a very painful experience, but seems to be improving. I am not using the gemset plugin, as I'm relying on Bundler to manage gems for my projects. I'm using the following command:

bundle install --path .gems

to install my gems in each project's app root.

Suddenly, my most important project is reporting this error:

/Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/bundler-1.6.3/lib/bundler/lockfile_parser.rb:33:in `initialize': Your Gemfile.lock contains merge conflicts. (Bundler::LockfileError)
Run `git checkout HEAD -- Gemfile.lock` first to get a clean lock

But there are no merge conflicts at all in my Gemfile.lock. I refuse to delete it and go through updating all of these gems again. How can I get Bundler to stop falsely reporting this error?


Solution

  • Here's the code from Bundler that implements that check:

      if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
        raise LockfileError, "Your Gemfile.lock contains merge conflicts.\n" \
          "Run `git checkout HEAD -- Gemfile.lock` first to get a clean lock."
      end
    

    Check that your Gemfile.lock doesn't contain those stray conflict markers.