升级Ruby版本时出错:未定义的方法“ yaml_as”

时间:2018-12-06 16:38:55

标签: ruby-on-rails ruby

我将Rails应用程序的ruby版本从2.2.1升级到了2.5.1。但是,当我尝试启动Rails服务器时,它给了我这个错误。

constant OpenSSL::SSL::SSLContext::METHODS is deprecated Traceback (most recent call last):     
25: from bin/rails:4:in `<main>'    
24: from bin/rails:4:in `require'   
23: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/railties-4.2.10/lib/rails
  /commands.rb:17:in `<top (required)>'     
22: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/railties-4.2.10/lib/rails
  /commands/commands_tasks.rb:39:in `run_command!'  
21: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/railties-4.2.10/lib/rails
  /commands/commands_tasks.rb:75:in `server'    
20: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/railties-4.2.10/lib/rails
  /commands/commands_tasks.rb:75:in `tap'   
19: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/railties-4.2.10/lib/rails
  /commands/commands_tasks.rb:78:in `block in server'   
18: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/railties-4.2.10/lib/rails
  /commands/commands_tasks.rb:78:in `require'   
17: from /home/jaydee/source/ruby-upgrade/shiftshark/config
  /application.rb:6:in `<top (required)>'   
16: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.1
  /lib/bundler.rb:114:in `require'  
15: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.1/lib/bundler
  /runtime.rb:65:in `require'   
14: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.1/lib/bundler
  /runtime.rb:65:in `each'  
13: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.1/lib/bundler
  /runtime.rb:76:in `block in require'  
12: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.1/lib/bundler
  /runtime.rb:76:in `each'  
11: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.1/lib/bundler
  /runtime.rb:81:in `block (2 levels) in require'   
10: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.1/lib/bundler
  /runtime.rb:81:in `require'    
9: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/delayed_job_active_record-
  4.0.3/lib/delayed_job_active_record.rb:5:in `<top (required)>'     
8: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/delayed_job-4.0.6/lib
  /delayed/worker.rb:64:in `backend='    
7: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/activesupport-4.2.10
  /lib/active_support/dependencies.rb:274:in `require'   
6: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/activesupport-4.2.10
  /lib/active_support/dependencies.rb:240:in `load_dependency'   
5: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/activesupport-4.2.10
  /lib/active_support/dependencies.rb:274:in `block in require'      
4: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/activesupport-4.2.10
  /lib/active_support/dependencies.rb:274:in `require'   
3: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/delayed_job-4.0.6/lib
  /delayed/serialization/active_record.rb:2:in `<top (required)>'    
2: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/delayed_job-4.0.6/lib
  /delayed/serialization/active_record.rb:3:in `<module:ActiveRecord>'   
1: from /home/jaydee/.rvm/gems/ruby-2.5.1/gems/delayed_job-4.0.6/lib
  /delayed/serialization/active_record.rb:4:in `<class:Base>'
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/activerecord-4.2.10
  /lib/active_record/dynamic_matchers.rb:26:in `method_missing': 
undefined method `yaml_as' for ActiveRecord::Base:Class (NoMethodError) 
Did you mean?  yaml_tag

1 个答案:

答案 0 :(得分:0)

由于yaml_as方法已不存在(它是由ruby内置的lib psych定义的),因此无法启动。

您需要更新delayed_job的版本。参见此github issue

只需运行bundle update delayed_job