我在尝试运行命令时遇到错误:
rails g active_admin:install
错误是:
user @ user1:〜/ projectX $ rails g active_admin:install 调用设计 /home/user/.rvm/gems/ruby-2.2.0/bundler/gems/activeadmin-6bde1f57ec5f/lib/generators/active_admin/devise/devise_generator.rb:21:in
rescue in install_devise': uninitialized constant ActiveAdmin::Generators::DeviseGenerator::DependencyError (NameError) from /home/user/.rvm/gems/ruby-2.2.0/bundler/gems/activeadmin-6bde1f57ec5f/lib/generators/active_admin/devise/devise_generator.rb:19:in
install_devise' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:inrun' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in
invoke_command' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:inblock in invoke_all' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
每个' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:inmap' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
invoke_all' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:indispatch' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in
调用' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:277:inblock in _invoke_for_class_method' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/shell.rb:68:in
with_padding' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:266:in_invoke_for_class_method' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:133:in
_ invoke_from_option_users' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:inrun' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in
invoke_command' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:inblock in invoke_all' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
每个' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:inmap' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
invoke_all' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:indispatch' from /home/user/.rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in
start' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/generators.rb:157:ininvoke' from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/generate.rb:13:in
' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:123:inrequire_command!' from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:130:in
generate_or_destroy' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:50:ingenerate' from /home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in
run_command!' 来自/home/user/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in<top (required)>' from /home/user/projectX/bin/rails:8:in
' 来自/home/user/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from /home/user/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
require' 来自-e:1:在''
安装了主动管理和设计宝石。唯一的问题是我生成活动管理员。我使用Rails-4.1.8和ruby-2.1.4。
感谢您的帮助和美好的一天。
答案 0 :(得分:6)
您需要将devise
gem添加到您的Gemfile
gem 'devise'
或者您需要使用--skip-users
标志运行安装。
rails g active_admin:install --skip-users
答案 1 :(得分:-1)
activeadmin
gem(我的意思是rubygems.org上的最新版本的gem)仍然与Rails 4.x不兼容。
尝试使用来自存储库的最新版本的activeadmin:
gem 'activeadmin', github: 'activeadmin/activeadmin', branch: :master
答案 2 :(得分:-1)
适合我。
gem 'devise', '~> 3.2'