bonsai-elasticsearch-rails - 不能要求 'elasticsearch/rails/tasks/import'
bonsai-elasticsearch-rails - cannot require 'elasticsearch/rails/tasks/import'
当我运行:
$ heroku run bundle exec rake environment elasticsearch:import:model CLASS='Artist' FORCE=true
终端中的响应是:
Running bundle exec rake environment elasticsearch:import:model CLASS=Artist FORCE=true on doremi... up, run.3015
Starting up a new ElasticSearch client with https://hexcode.bonsai.io
rake aborted!
NameError: uninitialized constant Elasticsearch
/app/vendor/bundle/ruby/2.0.0/gems/bonsai-elasticsearch-rails-0.0.4/lib/bonsai/elasticsearch/rails.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:85:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:85:in `rescue in block in require'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:68:in `block in require'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
/app/config/application.rb:16:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
错误似乎源于 lib/tasks/elasticsearch.rake
中的这条要求语句
require 'elasticsearch/rails/tasks/import'
我已经检查过我所有的 elastic-*
gem 都是最新版本:elasticsearch-rails 和 elasticsearch-model 是 0.1.7,bonsai-elasticsearch-[ 是 0.0.4 =29=],但是我确实在这里 https://rubygems.org/gems/bonsai-elasticsearch-rails 注意到 bonsai-elastic-search rails 依赖于 bundler 1.5,而 Heroku 使用的是 1.9.7,据我所知这是不可能改变的。这会是问题的症结所在吗?
当我尝试部署时,我的日志中也有类似的错误
Oct 09 17:04:27 doremi app/worker.1: NameError: uninitialized constant Elasticsearch
Oct 09 17:04:27 doremi app/worker.1: rake aborted!
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bonsai-elasticsearch-rails-0.0.4/lib/bonsai/elasticsearch/rails.rb:4:in `<top (required)>'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:85:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:85:in `rescue in block in require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:68:in `block in require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/config/application.rb:16:in `<top (required)>'
Oct 09 17:04:27 doremi app/worker.1: /app/Rakefile:4:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/Rakefile:4:in `<top (required)>'
Oct 09 17:04:27 doremi app/worker.1: LoadError: cannot load such file -- bonsai-elasticsearch-rails
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/config/application.rb:16:in `<top (required)>'
Oct 09 17:04:27 doremi app/worker.1: /app/Rakefile:4:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/Rakefile:4:in `<top (required)>'
rails/bundler 要求 gem 按照它们在 gemfile 中声明的顺序排列。发生此错误是因为我在 elasticsearch-rails
和 elasticsearch-model
之上声明了 bonsai-elasticsearch-rails
。因此,通过在其他两个下面声明 bonsai-elasticsearch-rails
来解决这个问题。
当我运行:
$ heroku run bundle exec rake environment elasticsearch:import:model CLASS='Artist' FORCE=true
终端中的响应是:
Running bundle exec rake environment elasticsearch:import:model CLASS=Artist FORCE=true on doremi... up, run.3015
Starting up a new ElasticSearch client with https://hexcode.bonsai.io
rake aborted!
NameError: uninitialized constant Elasticsearch
/app/vendor/bundle/ruby/2.0.0/gems/bonsai-elasticsearch-rails-0.0.4/lib/bonsai/elasticsearch/rails.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:85:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:85:in `rescue in block in require'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:68:in `block in require'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
/app/config/application.rb:16:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
错误似乎源于 lib/tasks/elasticsearch.rake
require 'elasticsearch/rails/tasks/import'
我已经检查过我所有的 elastic-*
gem 都是最新版本:elasticsearch-rails 和 elasticsearch-model 是 0.1.7,bonsai-elasticsearch-[ 是 0.0.4 =29=],但是我确实在这里 https://rubygems.org/gems/bonsai-elasticsearch-rails 注意到 bonsai-elastic-search rails 依赖于 bundler 1.5,而 Heroku 使用的是 1.9.7,据我所知这是不可能改变的。这会是问题的症结所在吗?
当我尝试部署时,我的日志中也有类似的错误
Oct 09 17:04:27 doremi app/worker.1: NameError: uninitialized constant Elasticsearch
Oct 09 17:04:27 doremi app/worker.1: rake aborted!
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bonsai-elasticsearch-rails-0.0.4/lib/bonsai/elasticsearch/rails.rb:4:in `<top (required)>'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:85:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:85:in `rescue in block in require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:68:in `block in require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/config/application.rb:16:in `<top (required)>'
Oct 09 17:04:27 doremi app/worker.1: /app/Rakefile:4:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/Rakefile:4:in `<top (required)>'
Oct 09 17:04:27 doremi app/worker.1: LoadError: cannot load such file -- bonsai-elasticsearch-rails
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/config/application.rb:16:in `<top (required)>'
Oct 09 17:04:27 doremi app/worker.1: /app/Rakefile:4:in `require'
Oct 09 17:04:27 doremi app/worker.1: /app/Rakefile:4:in `<top (required)>'
rails/bundler 要求 gem 按照它们在 gemfile 中声明的顺序排列。发生此错误是因为我在 elasticsearch-rails
和 elasticsearch-model
之上声明了 bonsai-elasticsearch-rails
。因此,通过在其他两个下面声明 bonsai-elasticsearch-rails
来解决这个问题。