-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vendored Bundler causes LoadError when running bundle exec
from ruby script after bundler/setup
#2055
Comments
Calling `bundle exec` from a ruby script after Bundler has been set up fails for vendored Bundler version that comes with Rubygems 2.7. rubygems/rubygems#2055 `rake pageflow:dummy` invokes `bundle exec rails new`. Calling `rake` via `bundle exec` can be used as a temporary workaround.
Calling `bundle exec` from a ruby script after Bundler has been set up fails for vendored Bundler version that comes with Rubygems 2.7. rubygems/rubygems#2055 `rake pageflow:dummy` invokes `bundle exec rails new`. Calling `rake` via `bundle exec` can be used as a temporary workaround.
I was able to reproduce this on my system with Ruby 2.3.3, Rubygems 2.7.0 and Bundler 1.16.0 Updated to the latest stable Rubygems (2.7.1) and the issue went away. Edit: With Rubygems 2.7.1, I no longer see an error for the |
@tf Can you try with RubyGems 2.7.3? I couldn't reproduce RG 2.7.3 with your reproducible repository. see. https://travis-ci.org/hsbt/bundler-executable-not-found/builds/309343716 |
RubyGems 2.7.3 appears so have fixed the problem. I can also no longer reproduce the problem in the project where I originally encountered the issue. |
@tf Thanks for your confirmation and reporting this issue. |
The issue exists with RubyGems 2.7.3 & Bundler 1.16.1. Fixed if using Bundler 1.16.0 |
There are currently issues with certain upstream version combinations: rubygems/bundler#6144 rubygems/rubygems#2055 So don't do a manual update of the bundler gem until they are resolved so we can continue to run travis builds in the meantime.
Unfortunately, rubygems/rubygems#2055 is a bug that forces us to use bundler 1.16.0 instead of 1.16.1.
This should help address rubygems/rubygems#2055 temporarily
Because of rubygems/rubygems#2055. The rubocop new rules fixes for inverse_of everywhere. Also preparing for a ruby 2.4.3 upgrade
Calling `bundle exec` from a ruby script after Bundler has been set up fails for vendored Bundler version that comes with Rubygems 2.7. rubygems/rubygems#2055 `rake pageflow:dummy` invokes `bundle exec rails new`. Calling `rake` via `bundle exec` can be used as a temporary workaround.
@tf Based on the fact that this problem still exists in Travis CI, and therefore many projects are pinning Bundler to 1.16.0 in CI, is there a disconnect between the way you are failing to reproduce, and what all these projects are seeing? Should this issue be re-opened until all the projects see it as resolved? |
It's the environment of Travis issue. not rubygems maybe. https://travis-ci.org/colszowka/simplecov/jobs/326822785 I investigate above log. Can you try to use It's complex problem with rubygems, bundler, rvm, and travis on https://github.com/travis-ci/travis-rubies |
👋 The travis cache might be to blame. Build overview: https://travis-ci.org/colszowka/simplecov/builds/328432586?utm_source=github_status&utm_medium=notification Ruby versions 2.2+ were updated. edit: disabled cache, works now - one of the failures seems to be flaky but unrelated https://travis-ci.org/colszowka/simplecov/builds/328434182 |
@PragTob Great. Thanks for your investigation. I try to fix this issue with Travis together. |
@hsbt FYI I opened travis-ci/travis-ci#9062 with travis but maybe you got an insight. Thanks for your work! :) |
The builds are failing due to a strange error where rake cannot find other dependencies. bundler: failed to load command: rake LoadError: cannot load such file -- bundler/dep_proxy It appears this is a known issue (travis-ci/travis-ci#9062) which links to a Ruby Gem issue (rubygems/rubygems#2055). This implements a hopefully simple fix which ensures bundler is updated on the system, and that the installed version of Rails has the bundler gem available.
See rubygems/bundler#6144
Problem
Trying to run the following script when gems have been installed with
bundle install --deployment
fails with
Minimal example:
https://github.com/tf/bundler-executable-not-found
https://travis-ci.org/tf/bundler-executable-not-found/builds/296324791
If
Gem.activate_bin_path('bundler', 'bundle', '>= 0.a')
(which is what is loaded in thebundle
executable) is called for the first time afterbundler/setup
, it reports the missing path.rvm/rubies/ruby-2.1.7/lib/ruby/site_ruby/exe/bundle
. If it is called beforebundler/setup
, the correct value is already cached. The above Travis build contains examples of both cases for different Ruby versions.In my case this causes all invocations of the form
system('bundler exec ...')
to fail that come from a binstub since binstubs include thebundler/setup
line.Cause
I looked at the code and here's what is happening:
When
bundler/setup
is loaded, it patches Rubygems and overridesactivate_bin_path
to return the contents ofENV["BUNDLE_BIN_PATH"]
when we are looking for the bin path of the bundler executable:https://github.com/bundler/bundler/blob/d17f2e43236ba53f05b70e7317d218ba94e293c8/lib/bundler/rubygems_integration.rb#L472-L483
This environment variable is set by first trying to look up the bin path via rubygems, but falls back to a fixed relative path to Bundler's
exe
directory:https://github.com/bundler/bundler/blob/d17f2e43236ba53f05b70e7317d218ba94e293c8/lib/bundler/shared_helpers.rb#L294-L300
When gems have been installed with
bundle install --deployment
, this rescue case kicks in, because apparently Bundler does not include its own sources in thevendor/bundle
directory.In the presence of Rubygems 2.7,
shared_helpers.rb
is loaded from.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/bundler/shared_helpers.rb
. But there simply is no../../../exe/bundle
directory in the vendored version of Bundler.System Info
This issue is related to:
gem
Here are my current environment details:
I will abide by the code of conduct.
The text was updated successfully, but these errors were encountered: