Okay, that’s interesting. gem regenerate_binstubs is provided by the executable-hooks gem via rubygems-bundler, which RVM installs by default. That extension should be available to the gem command if it’s the version installed by RVM…
In any case, while we work on a better solution, gem install bundler -v 1.10.6 && gem install rubygems-bundler && gem regenerate_binstubsshould make the version of bundler available that you want (it might need to be combined Kim’s suggested echo Y | rvm @global do gem uninstall bundler )
None of the above solutions work for me either using ruby 2.3.0, and we likewise can’t complete any builds without a resolution. I have attempted these steps in the override and post dependencies steps with no luck:
I’ve also tried pointing Circle directly to the binary, which it finds, but then fails. Oddly, this exact command works properly when I SSH into the build and run it.
[pollinate] Running RACK_ENV=development BUNDLE_GEMFILE=./Gemfile /home/ubuntu/.rvm/gems/ruby-2.3.0/bin/bundle exec rails db:create db:schema:load in /home/ubuntu/pollinate-v4/api
/home/ubuntu/.rvm/gems/ruby-2.3.0/bin/bundle:22:in `load': cannot load such file -- /home/ubuntu/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/gems/bundler-1.11.2/bin/bundle (LoadError)
from /home/ubuntu/.rvm/gems/ruby-2.3.0/bin/bundle:22:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /home/ubuntu/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
It’s correct – /home/ubuntu/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/gems/bundler-1.11.2/bin/bundle does not exist. I just don’t know why it’s looking for it. (It doesn’t look for it when the command is run via SSH.)
I was running into the same with v1.11.2. If you use 1.10.6 explictly, it should work.
This is what I am doing in my circle.yml (dependencies:pre):
rvm @global do gem uninstall bundler -a -x
gem install bundler -v 1.10.6
gem install rubygems-bundler
gem regenerate_binstubs
FWIW, not sure if this is compounding the situation, but it appears >=1.11.x also has some similiarly weird issues being investigated by the bundler team, related to binstubs and nested bundle exec calls.
[pollinate] Running RACK_ENV=development BUNDLE_GEMFILE=./Gemfile bundle exec rails db:create db:schema:load in /home/ubuntu/pollinate-v4/api
/home/ubuntu/.rvm/gems/ruby-2.3.0/bin/bundle:22:in `load': cannot load such file -- /home/ubuntu/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/gems/bundler-1.10.6/bin/bundle (LoadError)
from /home/ubuntu/.rvm/gems/ruby-2.3.0/bin/bundle:22:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /home/ubuntu/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
cd cli; ./pollinate setup returned exit code 1
The path it’s looking for bundle in looks weird: /home/ubuntu/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/gems/bundler-1.10.6/bin/bundle. Is that really where it’s supposed to live, or is that command getting generated incorrectly somehow?
The line that’s complaining in the bundler executable is simply:
Can any CircleCI staff inform us on what the problem is? I have tried explicitly setting bundler versions and ruby versions through rvm’s global gemset but still get the LoadError issue when I try to run my builds.
This issue is currently disrupting our entire CI flow, we would appreciate some indication of a timeline / root-cause / work-around that we could use effectively to get around this issue!
The issue is that in our recent container image update, we upgraded Rubygems from 2.6.0 to 2.6.2. This is a bug in Rubygems 2.6.2, which is fixed by this Rubygems commit. There isn’t a new version of Rubygems available yet, but you can install the head version with:
So the planets have aligned to give us a bug in bundler at the same time as a bug in Rubygems. Maybe now is a good time to buy a lottery ticket
The bundler bug seems specific to Rubygems 2.6.2, though it’s present in Rubygems-head as well. I’ve tried this against Bundler 1.12.0.rc and it appears that the issue is still around. I’ve reproduced the load error and made it go away with an older version of Rubygems. Here’s the circle.yml file:
We were able to work around our problem by not 'double bundle exec’ing … basically we had a rake task that also ran a system() call to bundle exec … which is directly related to the bug opened on the bundler project
So it looks like it will solve the rvm @global gem uninstall bundler workaround earlier in this thread. We’re rolling it into our next image update, which will be out soon. The issue with a double-wrapped bundle exec is not yet fixed in bundler. It’s latest stable version is still 1.11.2.
If you have problem with random failing bundler on CI then you may want to switch to Ubuntu 14.04 (Trusty) image in Project Settings -> Build Environment.
Example error I had on Ubuntu 12.04 image:
/home/ubuntu/.rvm/gems/ruby-2.3.0@global/bin/bundle:22:in `load': cannot load such file -- /home/ubuntu/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.9.5/lib/gems/bundler-1.9.5/bin/bundle (LoadError)
from /home/ubuntu/.rvm/gems/ruby-2.3.0@global/bin/bundle:22:in `<main>'
Nice to see you here @ArturT - can confirm that using Ubuntu 14.04 fixes the bundler version issue.
Worth noting that Circle’s Ubuntu 14.04 has different package versions pre-installed. Verify that they align with your project’s dependencies, otherwise your build may break or slow down by having to install a specific package version every time. Details at https://circleci.com/docs/build-image-trusty