You must use Bundler 2 or greater with this lockfi

2019-02-05 04:53发布

I'm working with heroku and every time I try to push my app this message shows out:

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: 
remote:  !
remote:  !     You must use Bundler 2 or greater with this lockfile.
remote:  !
remote: /tmp/d20181109-104-g861yi/bundler-1.15.2/gems/bundler-1.15.2/lib/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version': You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)
remote:     from /tmp/d20181109-104-g861yi/bundler-1.15.2/gems/bundler-1.15.2/lib/bundler/lockfile_parser.rb:95:in `initialize'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/bundler_wrapper.rb:130:in `new'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/bundler_wrapper.rb:130:in `block in parse_gemfile_lock'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:40:in `yield_with_block_depth'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:17:in `block in instrument'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:16:in `instrument'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/bundler_wrapper.rb:86:in `instrument'
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to my-proyect-1234.
remote: 

It says 'remote: ! You must use Bundler 2 or greater with this lockfile.'

But my Bundler version is 2.0.0.pre.1

Don't know what to do, I tried uninstalling bundle and installing it again, I errased the Gemfile.lock and typing bundle again

5条回答
放我归山
2楼-- · 2019-02-05 05:26

I deleted the project and made a git clone from the Heroku app, don´t know if it is a good solution, but it worked for me.

查看更多
在下西门庆
3楼-- · 2019-02-05 05:27

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:

Open lib/language_pack/ruby.rb in your editor, and change the following line:

BUNDLER_VERSION = "1.11.2"

(README.md at https://github.com/heroku/heroku-buildpack-ruby)

查看更多
唯我独甜
4楼-- · 2019-02-05 05:31

Yup, so generally uninstalling your version of bundler, removing the gemfile.lock, and finally running gem install bundler -v 1.15.2(which is the version heroku is using) worked.

After that running git push heroku master worked!

查看更多
我想做一个坏孩纸
5楼-- · 2019-02-05 05:31

I resolved this issue by running gem uninstall bundler to remove 2.0.0.pre.1, renamed the Gemfile.lock file (to remove it from use) and then ran bundle install to reinstall the gemfiles. In my case, I already had access to the earlier bundler version installed by heroku (so when I ran gem uninstall, I was shown all versions available and chose to remove 2.0.0.pre.1).

查看更多
放我归山
6楼-- · 2019-02-05 05:34

A bit late to the party but I just ran into this today as well, and this solution avoids having to uninstall Bundler: just run

heroku buildpacks:set https://github.com/bundler/heroku-buildpack-bundler2

as per discussion on the Bundler issue here.

查看更多
登录 后发表回答