Rails 5生产错误:无法定义多个'包含'关注的块(ActiveSupport :: Concern :: MultipleIncludedBlocks)

时间:2018-04-07 15:22:41

标签: ruby-on-rails ruby rubygems solidus chruby

我在部署生产(远程和本地)时遇到错误。 开发运行得很好。

/Users/nope/.gem/ruby/2.5.1/gems/activesupport- 
5.1.6/lib/active_support/concern.rb:126:in `included': Cannot define multiple 
'included' blocks for a Concern 
(ActiveSupport::Concern::MultipleIncludedBlocks)

Rails 5 app,使用solidus的简单网上商店。

环境:

  • Ruby 2.3.1
  • (或ruby 2.5.1)
  • Rails 5.1.6
  • Bundler 1.16.1
  • CHRUBY

宝石:

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.5'

gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'


gem 'toastr-rails'

gem 'solidus'
gem 'solidus_auth_devise'
gem 'deface', '~> 1.0.2'

gem 'solidus_reviews', github: 'solidusio-contrib/solidus_reviews'

gem 'solidus_related_products', github: 'solidusio-contrib/solidus_related_products'
gem 'solidus_email_to_friend', github: 'boomerdigital/solidus_email_to_friend', branch: 'master'

group :production do 
  gem 'pg'
end

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  gem 'sqlite3'
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'guard-livereload', '~> 2.5', require: false
  gem "rack-livereload"
  gem 'pry-rails'


  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]


ruby '2.5.1'

=> Booting Puma
=> Rails 5.1.6 application starting in production
=> Run `rails server -h` for more startup options
Exiting
Traceback (most recent call last):
  76: from bin/rails:3:in `<main>'
  75: from bin/rails:3:in `load'
  74: from /Users/nope/Projects/shopbonaire/shopbonaire.com/bin/spring:15:in `<top (required)>'
  73: from /Users/nope/Projects/shopbonaire/shopbonaire.com/bin/spring:15:in `require'
  72: from /Users/nope/.gem/ruby/2.5.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
  71: from /Users/nope/.gem/ruby/2.5.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
  70: from /Users/nope/.gem/ruby/2.5.1/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
  69: from /Users/nope/.gem/ruby/2.5.1/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
  68: from /Users/nope/.gem/ruby/2.5.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
  67: from /Users/nope/.gem/ruby/2.5.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
  66: from /Users/nope/.gem/ruby/2.5.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
  65: from /Users/nope/Projects/shopbonaire/shopbonaire.com/bin/rails:9:in `<top (required)>'
  64: from /Users/nope/Projects/shopbonaire/shopbonaire.com/bin/rails:9:in `require'
  63: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>'
  62: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/command.rb:44:in `invoke'
  61: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/command/base.rb:63:in `perform'
  60: from /Users/nope/.gem/ruby/2.5.1/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
  59: from /Users/nope/.gem/ruby/2.5.1/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
  58: from /Users/nope/.gem/ruby/2.5.1/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
  57: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `perform'
  56: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `tap'
  55: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:135:in `block in perform'
  54: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:44:in `start'
  53: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/server.rb:283:in `start'
  52: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/server.rb:354:in `wrapped_app'
  51: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:24:in `app'
  50: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/server.rb:219:in `app'
  49: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/server.rb:319:in `build_app_and_options_from_config'
  48: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/builder.rb:40:in `parse_file'
  47: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/builder.rb:49:in `new_from_string'
  46: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/builder.rb:49:in `eval'
  45: from config.ru:in `<main>'
  44: from config.ru:in `new'
  43: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/builder.rb:55:in `initialize'
  42: from /Users/nope/.gem/ruby/2.5.1/gems/rack-2.0.4/lib/rack/builder.rb:55:in `instance_eval'
  41: from config.ru:3:in `block in <main>'
  40: from config.ru:3:in `require_relative'
  39: from /Users/nope/Projects/shopbonaire/shopbonaire.com/config/environment.rb:5:in `<top (required)>'
  38: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!'
  37: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers'
  36: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
  35: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
  34: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
  33: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call'
  32: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each'
  31: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
  30: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
  29: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
  28: from /Users/nope/.rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
  27: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers'
  26: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run'
  25: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec'
  24: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/application/finisher.rb:67:in `block in <module:Finisher>'
  23: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/application/finisher.rb:67:in `each'
  22: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/engine.rb:354:in `eager_load!'
  21: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/engine.rb:473:in `eager_load!'
  20: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/engine.rb:473:in `each'
  19: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/engine.rb:475:in `block in eager_load!'
  18: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/engine.rb:475:in `each'
  17: from /Users/nope/.gem/ruby/2.5.1/gems/railties-5.1.6/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
  16: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:251:in `require_dependency'
  15: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:335:in `depend_on'
  14: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:357:in `require_or_load'
  13: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:36:in `load_interlock'
  12: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:11:in `loading'
  11: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
  10: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
   9: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:36:in `block in load_interlock'
   8: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:374:in `block in require_or_load'
   7: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:476:in `load_file'
   6: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:662:in `new_constants_in'
   5: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:477:in `block in load_file'
   4: from /Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:477:in `load'
   3: from /Users/nope/.gem/ruby/2.5.1/gems/solidus_core-2.5.0/app/models/concerns/spree/user_methods.rb:1:in `<top (required)>'
   2: from /Users/nope/.gem/ruby/2.5.1/gems/solidus_core-2.5.0/app/models/concerns/spree/user_methods.rb:2:in `<module:Spree>'
   1: from /Users/nope/.gem/ruby/2.5.1/gems/solidus_core-2.5.0/app/models/concerns/spree/user_methods.rb:10:in `<module:UserMethods>'
/Users/nope/.gem/ruby/2.5.1/gems/activesupport-5.1.6/lib/active_support/concern.rb:126:in `included': Cannot define multiple 'included' blocks for a Concern (ActiveSupport::Concern::MultipleIncludedBlocks)

在阅读bootsnap主题(https://github.com/rails/rails/issues/15767)之后,回答&#34; Cannot define multiple 'included' blocks for a Concern (ActiveSupport::Concern::MultipleIncludedBlocks)&#34;我试过了:

切换config.cache_classes = false结果:没有区别。

切换config.autoload_paths_cache = false结果:没有区别。

1 个答案:

答案 0 :(得分:0)

答案:

将您的替代品置于关注文件夹中。