【问题标题】:`can't modify frozen Array (RuntimeError)` trying to update to Rails 5.1`can't modify freeze Array (RuntimeError)` 试图更新到 Rails 5.1
【发布时间】:2018-02-16 14:41:30
【问题描述】:

我正在将我的 rails 应用程序从 5.0 更新到 5.1,当我启动应用程序时,它会抛出以下内容:

 ~/workspace/productswatcher ➜ rails s
/files/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/react_on_rails-5.2.0/lib/react_on_rails/version.rb:3: warning: already initialized constant ReactOnRails::VERSION
/home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/react_on_rails-5.2.0/lib/react_on_rails/version.rb:3: warning: previous definition of VERSION was here
DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead. (called from <module:Haml> at /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/haml-4.0.7/lib/haml/helpers/safe_erubis_template.rb:3)
=> Booting Puma
=> Rails 5.1.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
bin/rails:6: warning: already initialized constant APP_PATH
/files/alter/workspace/productswatcher/bin/rails:6: warning: previous definition of APP_PATH was here
The most common rails commands are:
 generate     Generate new code (short-cut alias: "g")
 console      Start the Rails console (short-cut alias: "c")
 server       Start the Rails server (short-cut alias: "s")
 test         Run tests except system tests (short-cut alias: "t")
 test:system  Run system tests
 dbconsole    Start a console for the database specified in config/database.yml
              (short-cut alias: "db")

 new          Create a new Rails application. "rails new my_app" creates a
              new application called MyApp in "./my_app"


All commands can be run with -h (or --help) for more information.
In addition to those commands, there are:

/files/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:18: warning: already initialized constant Rails::Command::HELP_MAPPINGS
/home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:18: warning: previous definition of HELP_MAPPINGS was here
/home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/actionpack-5.1.3/lib/action_dispatch/middleware/stack.rb:74:in `insert': can't modify frozen Array (RuntimeError)
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/actionpack-5.1.3/lib/action_dispatch/middleware/stack.rb:74:in `insert'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/dragonfly-1.0.12/lib/dragonfly/railtie.rb:7:in `block in <class:Railtie>'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/initializable.rb:30:in `run'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/initializable.rb:59:in `block in run_initializers'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `each'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `call'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
        from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/initializable.rb:58:in `run_initializers'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/application.rb:353:in `initialize!'
        from /files/alter/workspace/productswatcher/config/environment.rb:5:in `<top (required)>'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `block in require'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/application.rb:329:in `require_environment!'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands/rake/rake_command.rb:31:in `rake_tasks'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands/rake/rake_command.rb:40:in `formatted_rake_tasks'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands/rake/rake_command.rb:10:in `printing_commands'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:91:in `each'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:91:in `flat_map'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:91:in `block in sorted_groups'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/core_ext/hash/transform_values.rb:26:in `block in transform_values!'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/core_ext/hash/transform_values.rb:25:in `each'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/core_ext/hash/transform_values.rb:25:in `transform_values!'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:91:in `sorted_groups'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:84:in `print_commands'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands/help/help_command.rb:9:in `help'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command/base.rb:63:in `perform'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:44:in `invoke'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands.rb:16:in `<top (required)>'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `block in require'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
        from bin/rails:8:in `<main>'

可能有什么问题?

【问题讨论】:

  • 面临同样的问题。轨道 5.1.4 红宝石 2.3.1

标签: ruby-on-rails ruby ruby-on-rails-5 ruby-on-rails-5.1


【解决方案1】:

看起来我有一个不兼容的bullet 版本(5.1.0),我修复它只是更新到最新的当前版本(5.6.1):

bundle update bullet

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-08-10
    • 1970-01-01
    • 2018-06-03
    • 1970-01-01
    • 2022-09-27
    • 2022-12-01
    • 1970-01-01
    • 2017-12-14
    相关资源
    最近更新 更多