Skip to content

Can't modify frozen autoload_paths in development environment #365

@ortegacmanuel

Description

@ortegacmanuel

Steps to reproduce

  1. Add gem "view_component" to Gemfile
  2. Add require "view_component/engine" to config/application.rb
  3. Run bin/rails generate component Example title content

Expected behavior

  1. The generator creates all files/templates for the new new ViewComponent

Actual behavior

  1. The generator crashes with the following errror:

`<<': can't modify frozen #<Class:#Array:0x00007ff3e041bcf8> (FrozenError

/home/manuel/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/change_observer.rb:10:in `<<': can't modify frozen #<Class:#<Array:0x00007ff3e041bcf8>> (FrozenError)
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/change_observer.rb:10:in `<<'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/view_component-2.7.0/lib/view_component/engine.rb:29:in `block in <class:Engine>'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `instance_exec'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `run'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/railties-6.0.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/railties-6.0.2.1/lib/rails/initializable.rb:60:in `run_initializers'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/railties-6.0.2.1/lib/rails/application.rb:363:in `initialize!'
	from /home/manuel/kodo/main-street/mainstreet/config/environment.rb:5:in `<top (required)>'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/zeitwerk-2.2.2/lib/zeitwerk/kernel.rb:23:in `require'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/spring-2.1.0/lib/spring/application.rb:106:in `preload'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
	from /home/manuel/.rvm/gems/ruby-2.5.1/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/manuel/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from -e:1:in `<main>'

System configuration

Rails version: Rails 6.0.2.1

Ruby version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]

Gem version: view_component-2.7.0

   # config/application.rb
   require 'rails/all'
   require "view_component/engine"
   module MyApp
    class Application < Rails::Application
      ...
      config.load_defaults "6.0"
      ...
    end
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions