Rails 5活动管理员安装问题

时间:2017-02-12 18:25:43

标签: ruby-on-rails activeadmin

我是rails的新手,并尝试在最新版本的ruby 2.3.0和rails5上添加活动管理员。我在gem文件中添加了以下行:

gem 'inherited_resources', github: 'activeadmin/inherited_resources'
gem 'activeadmin', github: 'activeadmin'

捆绑安装,然后我运行服务器,我收到以下错误:

C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/bundler/gems/inherited_resources-6fa6e5b9d29c/lib/inherited_resources.rb:30:in `block in <top (required)>': break from proc-closure (LocalJumpError)
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:49:in `each'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_controller/api.rb:145:in `<class:API>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_controller/api.rb:88:in `<module:ActionController>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_controller/api.rb:5:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `block in require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jbuilder-2.6.1/lib/jbuilder/railtie.rb:20:in `block (2 levels) in <class:Railtie>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:33:in `block in on_load'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:32:in `each'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:32:in `on_load'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jbuilder-2.6.1/lib/jbuilder/railtie.rb:19:in `block in <class:Railtie>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `instance_exec'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `run'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:54:in `run_initializers'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/application.rb:352:in `initialize!'
        from C:/Sites/second_project/config/environment.rb:5:in `<top (required)>'
        from C:/Sites/second_project/config.ru:3:in `require_relative'
        from C:/Sites/second_project/config.ru:3:in `block in <main>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
        from C:/Sites/second_project/config.ru:in `new'
        from C:/Sites/second_project/config.ru:in `<main>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/server.rb:59:in `app'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/server.rb:124:in `log_to_stdout'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/server.rb:77:in `start'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

我谷歌这些错误但似乎代码错误但是我没有在新创建的项目中编写任何代码只是尝试安装活动管理员练习。 请帮我解决这个问题。

2 个答案:

答案 0 :(得分:5)

这是由于recent bug。只需使用RubyGems的最新版本,而不是GitHub。如果从Gemfile中省略inherited_resources,默认情况下应该为你完成。

答案 1 :(得分:2)

以下是我在Gemfile中使用的内容:

gem 'activeadmin', github: 'activeadmin'
gem 'inherited_resources'

查看'inherited_resources'的github存储库,看起来好像repo中的当前版本已损坏。作为最佳实践,尝试使用您可以控制的gem版本(上面的调用对于生产应用程序来说甚至不是很干净)

为了解决这个问题,您可能还会遇到一些SSL错误,只需将以下内容添加到您的Gemfile中

gem 'openssl', '>=2.0.3'