spree-contrib / spree-multi-domain

Multiple Spree stores on different domains - single unified backed for processing orders
https://guides.spreecommerce.org
194 stars 191 forks source link

bootsnap uninitialized constant Spree::Tracker (NameError) #201

Open iyanghualin opened 5 years ago

iyanghualin commented 5 years ago

Hello, I'm trying the multi-store function. I followed the steps in the installation instruction, but I got an error when running the generation: bundle exec rails g spree_multi_domain:install

ruby: 2.5.5 rails: 5.2.2.1(5.2.3 the same) spree: 3.7.1

the error:

Traceback (most recent call last):
    61: from bin/rails:4:in `<main>'
    60: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    59: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    58: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    57: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    56: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    55: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<main>'
    54: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
    53: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
    52: from /home/harry/.gem/ruby/2.5.5/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    51: from /home/harry/.gem/ruby/2.5.5/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    50: from /home/harry/.gem/ruby/2.5.5/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    49: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/commands/generate/generate_command.rb:21:in `perform'
    48: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
    47: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/command/actions.rb:28:in `require_environment!'
    46: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
    45: from /home/harry/.gem/ruby/2.5.5/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
    44: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    43: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    42: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    41: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    40: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    39: from /home/harry/src/mystore/config/environment.rb:5:in `<main>'
    38: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
    37: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
    36: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
    35: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
    34: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
    33: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `call'
    32: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `each'
    31: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
    30: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
    29: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    28: from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
    27: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
    26: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
    25: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
    24: from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/application/finisher.rb:63:in `block in <module:Finisher>'
    23: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/reloader.rb:89:in `prepare!'
    22: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:131:in `run_callbacks'
    21: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `invoke_before'
    20: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `each'
    19: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `block in invoke_before'
    18: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:199:in `block in halting'
    17: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:605:in `block in default_terminator'
    16: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:605:in `catch'
    15: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator'
    14: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
    13: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:426:in `block in make_lambda'
    12: from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:426:in `instance_exec'
    11: from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:8:in `activate'
    10: from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:8:in `each'
     9: from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:9:in `block in activate'
     8: from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:9:in `glob'
     7: from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:10:in `block (2 levels) in activate'
     6: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
     5: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
     4: from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/app/models/spree/tracker_decorator.rb:1:in `<main>'
     3: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
     2: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
     1: from /home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/home/harry/.gem/ruby/2.5.5/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant': uninitialized constant Spree::Tracker (NameError)
iyanghualin commented 5 years ago

It seems not the problem of b bootsnap. I created a new project with the parameter --skip-bootsnap, The same error uninitialized constant Spree::Tracker (NameError) occurs again when I run the generator bundle exec rails g spree_multi_domain:install

/home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/app/models/spree/tracker_decorator.rb:1:in `<top (required)>': uninitialized constant Spree::Tracker (NameError)
    from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:10:in `block (2 levels) in activate'
    from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:9:in `glob'
    from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:9:in `block in activate'
    from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:8:in `each'
    from /home/harry/.gem/ruby/2.5.5/bundler/gems/spree-multi-domain-efdfcf68df3e/lib/spree_multi_domain/engine.rb:8:in `activate'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:426:in `instance_exec'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:426:in `block in make_lambda'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:605:in `catch'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:605:in `block in default_terminator'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:199:in `block in halting'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `block in invoke_before'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `each'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `invoke_before'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:131:in `run_callbacks'
    from /home/harry/.gem/ruby/2.5.5/gems/activesupport-5.2.3/lib/active_support/reloader.rb:89:in `prepare!'
    from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/application/finisher.rb:63:in `block in <module:Finisher>'
    from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
    from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
    from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `each'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `call'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
    from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
    from /home/harry/.gem/ruby/2.5.5/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
    from /home/harry/src/hello_spree/config/environment.rb:5:in `<top (required)>'
    from /home/harry/.gem/ruby/2.5.5/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
    from /home/harry/.gem/ruby/2.5.5/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
    from /home/harry/.gem/ruby/2.5.5/gems/spring-2.0.2/lib/spring/application.rb:102:in `preload'
    from /home/harry/.gem/ruby/2.5.5/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
    from /home/harry/.gem/ruby/2.5.5/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
    from /home/harry/.gem/ruby/2.5.5/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
    from /home/harry/.gem/ruby/2.5.5/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
    from /home/harry/.gem/ruby/2.5.5/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /opt/rubies/ruby-2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from -e:1:in `<main>'
vinaymehta commented 5 years ago

Any founding here? Facing same issues

kareemsalah227 commented 5 years ago

I'm facing the same issue

kareemsalah227 commented 5 years ago

I found this branch tracker-fix-3-5 in the repo branches, it actually works, so replace the gem line in your Gemfile with this: gem 'spree_multi_domain', github: 'spree-contrib/spree-multi-domain', branch: 'tracker-fix-3-5'

And then run the generator, and it will work, somebody has to review the changes in that branch and create a PR to master.

vinaymehta commented 5 years ago

Thanks @kareemsalah227 , it worked for me

rjaguene commented 5 years ago

Its working for me but when i try to create a new store i've go this error msg : ArgumentError in Spree::Admin::Stores#new Can't resolve image into URL: undefined method `to_model' for #

Anyone got an idea ?

waleolakareem commented 5 years ago

@kareemsalah227 Thank you

waleolakareem commented 5 years ago

@rjaguene in your project folder create this path app/views/spree/admin/stores/_form.html.erb. You can just start from spree also and create /admin/stores/_form.html.erb. then paste this in there https://github.com/spree-contrib/spree-multi-domain/edit/master/app/views/spree/admin/stores/_form.html.erb That should do it. it is because it is missing a .url after logo

westonganger commented 5 years ago

This is because Analytics and Tracking were moved to a gem in Spree v3.5.

To solve this error, just add gem 'spree_analytics_trackers' to your Gemfile.