Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After ruby update to 2.5.0, require 'bundler/setup' raise exception

Call rake from rails app after ruby 2.5.0 update, does not work.

$ rake
Traceback (most recent call last):
    22: from ./bin/rake:4:in `<main>'
    21: from ./bin/rake:4:in `require_relative'
    20: from /Users/user/work/hw/relocations_app/config/boot.rb:5:in `<top (required)>'
    19: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    18: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    17: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    16: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/setup.rb:10:in `<top (required)>'
    15: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
    14: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
    13: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
    12: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
    11: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for'
    10: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs'
     9: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:247:in `resolve'
     8: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:806:in `converge_locked_specs'
     7: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:874:in `expand_dependencies'
     6: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:874:in `each'
     5: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:887:in `block in expand_dependencies'
     4: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:887:in `each'
     3: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:888:in `block (2 levels) in expand_dependencies'
     2: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
     1: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
/Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- bundler/dep_proxy (LoadError)

config/boot.rb

# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.

bundler/setup can not be required.

A same problem is with passenger, to start rails app with that:

Error ID: 309814d3
  Error details saved to: /tmp/passenger-error-yCUWSg.html
  Message from application: cannot load such file -- bundler/setup (LoadError)
  /var/www/vhosts/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
  /var/www/vhosts/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

Have anybody a same problem with ruby 2.5.0?

like image 252
Exsemt Avatar asked Dec 25 '17 22:12

Exsemt


People also ask

How do I upgrade from Ruby to bundler 2?

If you need to upgrade Ruby, use your ruby version manager’s instructions. If you need to upgrade RubyGems, run gem update --system. All set? Ruby and RubyGems versions new enough? Great. Keep going. The first step in upgrading to Bundler 2 is installing the Bundler 2 gem.

What version of Ruby do I need to upgrade to?

You need to be using Ruby 2.3.0 or higher, and you need to have RubyGems 2.5.0 or higher. You can check your Ruby version by running ruby --version, and you can check your RubyGems version by running gem --version. If you need to upgrade Ruby, use your ruby version manager’s instructions. If you need to upgrade RubyGems, run gem update --system.

Which version of bundler should I use to run my LockFile?

If your lockfile was created by Bundler 2, your commands will be run by Bundler 2. Here’s an example Gemfile.lock that was created with Bundler 1.17.1. The version of Bundler in the BUNDLED WITH section is read by Bundler to determine which version of Bundler should run. Using the example lock above, Bundler 1 will be used, as you can see here:

Is bundler compatible with my system?

If you have questions about compatibility between Bundler and your system, please check the compatibility list. Bundler makes sure that Ruby can find all of the gems in the Gemfile (and all of their dependencies). If your app is a Rails app, your default application already has the code necessary to invoke bundler.


2 Answers

Fix is simple: update RubyGems min up to 2.7.4 version

gem update --system

RubyGems 2.7.4 includes bug fixes.

like image 54
Exsemt Avatar answered Oct 25 '22 03:10

Exsemt


Sadly the only solution here is to upgrade Bundler to >= 1.16.1. See https://github.com/heroku/heroku-buildpack-ruby/pull/738 for an example where this is fixed in theory, but is blocked by Heroku unfortunately.

Upgrade to Bundler 1.16.1+ and you won't have any more issues.

like image 22
Matthew O'Riordan Avatar answered Oct 25 '22 04:10

Matthew O'Riordan