当我尝试rake命令时,我收到此错误。 我有一个solr正常运行的应用程序,现在我正在尝试使用solr构建一个新的应用程序我无法继续
rake sunspot:install --trace
rake aborted!
LoadError: cannot load such file -- active_support/core_ext/object/to_json
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/sunspot_rails-2.0.0/lib/sunspot_rails.rb:4:in `require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/sunspot_rails-2.0.0/lib/sunspot_rails.rb:4:in `<top (required)>'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
/home/vaibhav/Mirraw/testing_solr/config/application.rb:7:in `<top (required)>'
/home/vaibhav/Mirraw/testing_solr/Rakefile:4:in `require'
/home/vaibhav/Mirraw/testing_solr/Rakefile:4:in `<top (required)>'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/rake_module.rb:28:in `load'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:689:in `raw_load_rakefile'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:94:in `block in load_rakefile'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:93:in `load_rakefile'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:77:in `block in run'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/lib/rake/application.rb:75:in `run'
/home/vaibhav/.rvm/gems/ruby-2.2.2/gems/rake-11.1.1/bin/rake:33:in `<top (required)>'
/home/vaibhav/.rvm/gems/ruby-2.2.2/bin/rake:23:in `load'
/home/vaibhav/.rvm/gems/ruby-2.2.2/bin/rake:23:in `<main>'
/home/vaibhav/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
/home/vaibhav/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
这是我的宝石文件,
gem 'rails', '4.2.2' gem 'sqlite3' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem 'sunspot_rails' group :development, :test do gem 'byebug' gem 'web-console', '~> 2.0' gem 'spring' end
有没有人能解决这个问题。
答案 0 :(得分:2)
这似乎是known problem。问题是Rails 4.1在ActiveSupport
核心扩展中重命名了一个文件,sunspot_rails
仍在尝试包含旧文件名。这已在this sunspot_rails
commit中得到解决,但它仍然是was not merged到sunspot_rails gem的稳定2.0分支。
总的来说,这个宝石似乎已经完全放弃了,所以你唯一的选择是尝试直接从github使用gem的master
分支,而不是稳定的2.0分支。
您可以通过更新Gemfile来实现,而不是:
gem 'sunspot_rails'
它会说:
gem 'sunspot_rails :github => 'sunspot/sunspot'
查看更多解释here。