I was able to use bundler v2 by adding require 'bundler' right before the require 'bundler/setup' line in both, bin/webpack and bin/webpack-dev-server
That's not an issue with Webpacker. That's Bundler telling you that your Gemfile.lock file was created by Bundler v2, however the major version of Bundler you're using is less than 2.
https://github.com/bundler/bundler/blob/v2.0.1/lib/bundler/lockfile_parser.rb#L108
Run bundle --version to see which version of Bundler is on your PATH.
I ran into this issue with webpacker as well, full issue here: https://github.com/bundler/bundler/issues/6937
The solution is to add require 'bundler' as @consti mentions, or (once it's released) to upgrade to Ruby 2.6.2.
Ruby 2.5.3
Bundler 2.0.1
Webpacker 4.0.0-rc.7
No issues.
@jpickwell the issue only occurs if you have more than one version of bundler installed (under the same version of ruby). E.g. in your setup you can probably replicate the issue by doing a gem install bundler --version '< 2.0'.
@consti
$ gem list
...
bundler (2.0.1, default: 1.17.3)
...
@jpickwell if you have Bundler as a default gem I鈥檓 pretty sure you鈥檙e on 2.6, not 2.5
@connorshea, I don't have 2.6 installed. I did upgrade gem: gem update --system
A lot of projects are having this problem, this advice from Jekyll worked for me: https://github.com/jekyll/jekyll/issues/7463#issuecomment-451686361
So the solution presented in that comment is running gem update --system.
Most helpful comment
I was able to use
bundler v2by addingrequire 'bundler'right before therequire 'bundler/setup'line in both,bin/webpackandbin/webpack-dev-server