RAILS:升级到Ruby 2.5.3后无法修改冻结的SystemStackError(FrozenError)

时间:2018-11-30 15:12:18

标签: ruby-on-rails ruby

我的Rails 4.2.0应用程序从Ruby 2.2升级到最新的Ruby 2.5.3后出现错误。我应该使用旧版本的Ruby吗?

DEPRECATION WARNING: The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions. (called from <top (required)> at C:/D/code/rails_proj/cis/config/application.rb:7)
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000

跟踪:

    DEPRECATION WARNING: The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions. (called from <top (required)> at C:/D/code/rails_proj/cis/config/application.rb:7)
Exiting
Traceback (most recent call last):
        15: from bin/rails:4:in `<main>'
        14: from bin/rails:4:in `require'
        13: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
        12: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        11: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
        10: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
         9: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
         8: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-4.2.0/lib/rails/commands/server.rb:75:in `start'
         7: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-4.2.0/lib/rails/commands/server.rb:125:in `print_boot_information'
         6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rack-1.6.11/lib/rack/server.rb:291:in `server'
         5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rack-1.6.11/lib/rack/handler.rb:16:in `get'
         4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rack-1.6.11/lib/rack/handler.rb:90:in `try_require'
         3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
         2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
         1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- rack/handler/d (LoadError)

这里是垃圾箱/轨道:

#!/usr/bin/env ruby.exe
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'      <==caused error above

1 个答案:

答案 0 :(得分:1)

您可以尝试使用upgrade to the latest version of Rails 4.2或使用低于2.3(introduction of frozen_string_literal pragma)的Ruby版本。如果这些都不起作用,请查看stacktrace并尝试查看是否要修改已冻结的对象。