Constant `FreedomPatches::FastPluck` didn't be defined

When I run importer scripts, the error is thrown

mike@ubuntu:~/discourse/script/import_scripts$ ruby csv_importer.rb 
Traceback (most recent call last):
	37: from csv_importer.rb:4:in `<main>'
	36: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
	35: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
	34: from /home/mike/discourse/script/import_scripts/base.rb:16:in `<top (required)>'
	33: from /home/mike/discourse/script/import_scripts/base.rb:16:in `require_relative'
	32: from /home/mike/discourse/config/environment.rb:7:in `<top (required)>'
	31: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/railties-7.0.3.1/lib/rails/application.rb:372:in `initialize!'
	30: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/railties-7.0.3.1/lib/rails/initializable.rb:60:in `run_initializers'
	29: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
	28: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
	27: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
	26: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:347:in `call'
	25: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:347:in `each'
	24: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
	23: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
	22: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	21: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
	20: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/railties-7.0.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
	19: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/railties-7.0.3.1/lib/rails/initializable.rb:32:in `run'
	18: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/railties-7.0.3.1/lib/rails/initializable.rb:32:in `instance_exec'
	17: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/railties-7.0.3.1/lib/rails/application/finisher.rb:68:in `block in <module:Finisher>'
	16: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/reloader.rb:88:in `prepare!'
	15: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:106:in `run_callbacks'
	14: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:595:in `invoke_before'
	13: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:595:in `each'
	12: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:595:in `block in invoke_before'
	11: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:200:in `block in halting'
	10: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:686:in `block in default_terminator'
	 9: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:686:in `catch'
	 8: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:687:in `block (2 levels) in default_terminator'
	 7: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
	 6: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:445:in `block in make_lambda'
	 5: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:445:in `instance_exec'
	 4: from /home/mike/discourse/config/initializers/002-freedom_patches.rb:9:in `block in <main>'
	 3: from /home/mike/discourse/config/initializers/002-freedom_patches.rb:9:in `each'
	 2: from /home/mike/discourse/config/initializers/002-freedom_patches.rb:11:in `block (2 levels) in <main>'
	 1: from /home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:31:in `require'
/home/mike/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/callbacks.rb:25:in `on_file_autoloaded': expected file /home/mike/discourse/lib/freedom_patches/copy_file.rb to define constant FreedomPatches::CopyFile, but didn't (Zeitwerk::NameError)

my comman is bundle exec ruby zoho.rb
bundle exec ruby phpbb3.rb phpbb3/settings.yml, bundle exec ruby csv_importer.rb, ruby csv_importer.rb and so on.

1 Like

~/discourse needs to be the working directory when you execute import scripts, otherwise they will fail. In your case the following will work:

cd ~/discourse
ruby script/import_scripts/csv_importer.rb
5 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.