ruby-on-railsruby-on-rails-5spree

undefined method `alias_method_chain' updating Spree from 3.2 to 3.3


I am getting an error trying to run Spree 3.3 after following the steps to upgrade from 3.2 at https://guides.spreecommerce.org/developer/upgrades/three-dot-two-to-three-dot-three.html. I updated the Gemfile, ran bundle update, and then installed the migrations. I couldn't even run the migrations because of this same error:

/Users/vasco/.rvm/gems/ruby-2.4.9/gems/multi_fetch_fragments-0.0.17/lib/multi_fetch_fragments.rb:5:in `block in <module:MultiFetchFragments>': undefined method `alias_method_chain' for ActionView::PartialRenderer:Class (NoMethodError)
Did you mean?  alias_method
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/activesupport-5.1.7/lib/active_support/concern.rb:120:in `class_eval'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/activesupport-5.1.7/lib/active_support/concern.rb:120:in `append_features'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/multi_fetch_fragments-0.0.17/lib/multi_fetch_fragments.rb:95:in `include'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/multi_fetch_fragments-0.0.17/lib/multi_fetch_fragments.rb:95:in `block (2 levels) in <class:Railtie>'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/multi_fetch_fragments-0.0.17/lib/multi_fetch_fragments.rb:94:in `class_eval'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/multi_fetch_fragments-0.0.17/lib/multi_fetch_fragments.rb:94:in `block in <class:Railtie>'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `run'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/initializable.rb:59:in `block in run_initializers'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:347:in `each'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:347:in `call'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
    from /Users/vasco/.rvm/rubies/ruby-2.4.9/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/initializable.rb:58:in `run_initializers'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/application.rb:353:in `initialize!'
    from /Users/vasco/Documents/rails/hello-coffee/config/environment.rb:5:in `<top (required)>'
    from config.ru:3:in `require_relative'
    from config.ru:3:in `block in <main>'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:24:in `app'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:42:in `start'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:135:in `block in perform'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `tap'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `perform'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/command/base.rb:63:in `perform'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/command.rb:44:in `invoke'
    from /Users/vasco/.rvm/gems/ruby-2.4.9/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>'
    from bin/rails:8:in `require'
    from bin/rails:8:in `<main>'

I am on Ruby 2.4.9, Bundler 2.1.4, Rails 5.1.7 and Spree 3.3.6. Here is my Gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem 'rails', '~> 5.1.0'
gem 'pg'
# gem 'sqlite3'
gem 'activerecord-nulldb-adapter'
gem 'puma'
gem 'sass-rails'
gem 'uglifier'
# gem 'therubyracer', platforms: :ruby
gem 'coffee-rails'
gem 'turbolinks'
gem 'jbuilder'
gem 'jquery-rails'
gem "jquery-ui-rails"

group :development, :test do
  gem 'byebug'
  gem 'capybara'
  gem 'selenium-webdriver'
end

group :development do
  gem 'web-console'
  gem 'listen'
  gem 'spring'
  gem 'spring-watcher-listen'
  gem 'annotate'
end

gem 'dotenv-rails'
gem 'simple_form'
gem 'hamlit'
gem 'browser'
gem 'font-awesome-rails'

gem 'spree', '~> 3.3.0'
gem 'spree_auth_devise', '~> 3.3'
gem 'spree_gateway', '~> 3.3'
gem 'spree_i18n', github: 'spree-contrib/spree_i18n'
gem 'spree_globalize', github: 'spree-contrib/spree_globalize'
gem 'spree_social', github: 'spree-contrib/spree_social'
gem 'spree_paypal_express', github: 'spree-contrib/better_spree_paypal_express'

gem 'braintree'

gem 'daemons'
gem 'delayed_job_active_record'
gem 'devise-async'
gem 'whenever', require: false
gem 'multi_fetch_fragments'
gem 'prowl'
gem 'redis'
gem 'i18n_data'
gem 'http_accept_language'
gem 'chartkick'
gem 'groupdate'
gem 'exception_notification'
gem 'sitemap_generator'
gem 'redcarpet'
gem 'roo'
gem 'roo-xls'
gem 'inky-rb', require: 'inky'
gem "business_time"
gem "holidays"
gem 'ancestry'
gem 'sortable_tree_rails'
gem 'friendly_id'
gem 'globalize'
gem 'maxminddb'
gem 'rb-readline'
gem 'rest-client'
gem 'aws-sdk'
gem 'aws-sdk-rails'
gem 'fog-aws'
gem 'asset_sync'
gem 'savon'

How do I fix this?


Solution

  • For anyone else bumping into this, the multi_fetch_fragments gem has been merged into rails 5 itself and so the line

    gem 'multi_fetch_fragments'
    

    in my Gemfile was the culprit. Sources: https://github.com/n8/multi_fetch_fragments/issues/34 and https://github.com/rails/rails/pull/18948

    The error was gone after removing this gem from my Gemfile.