【问题标题】:How fix the issue when used the acviteadmin gem?使用 acviteadmin gem 时如何解决问题?
【发布时间】:2019-04-29 15:41:16
【问题描述】:

使用activeadmin进入gem文件。 bundle installrails g active_admin:install User,然后rails s,服务器会崩溃并给出一些警告。

错误信息:

rails s

WARNING: Nokogiri was built against LibXML version 2.9.4, but has dynamically loaded 2.8.0
=> Booting WEBrick
=> Rails 5.0.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
DEPRECATION WARNING: You are using the a deprecated processor interface #<Proc:0x0055902480b218@/home/guo/.rvm/gems/ruby-2.3.1/gems/autoprefixer-rails-5.2.1.3/lib/autoprefixer-rails/sprockets.rb:25>.
Please update your processor interface:
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from install at /home/guo/.rvm/gems/ruby-2.3.1/gems/autoprefixer-rails-5.2.1.3/lib/autoprefixer-rails/sprockets.rb:25)
Exiting

这是我的宝石清单。

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.0'

# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'

# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster.
# Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'

# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'activeadmin'
gem 'devise'
gem 'cancancan'
gem 'rolify'
gem 'draper'
gem 'pundit'

# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

gem 'bootstrap-sass', '~>3.3.7'
gem 'autoprefixer-rails', '~>5.2.1'
#gem "twitter-bootstrap-rails"

gem 'carrierwave', '>= 1.0.0.beta', '< 2.0' gem 'rmagick'

gem 'grape'

gem 'doorkeeper'

gem "rack-oauth2"

#gem 'will_paginate', '~> 3.1.1' gem 'kaminari'

gem 'dalli' gem 'actionpack-page_caching' gem 'actionpack-action_caching'

gem 'delayed_job' gem 'delayed_job_active_record' #gem "sidekiq"

#gem "devise-doorkeeper"

gem 'roadie'
gem 'roadie-rails'
gem 'nokogiri', '1.6.0'
#gem 'premailer-rails'

【问题讨论】:

  • 事实上,在 rails g active_admin:install User, rake db:migrate 之后,会有这样的失败:在 `load_missing_constant': Circular dependency detected while autoloading constant V1::Base (RuntimeError)
  • 这也可能是其他 SO 答案中提到的命名空间问题。 stackoverflow.com/questions/25460756/…

标签: ruby-on-rails ruby


【解决方案1】:

如果你使用的是 rails 5,试试这个:

gem 'inherited_resources', git: 'https://github.com/activeadmin/inherited_resources'
gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin'

并且还杀死现有服务器,正如@ray 所建议的那样,并启动服务器。你可以检查现有的服务器

ps aux|grep puma

它像这样打印所有 puma 进程

pragya_+  1378  0.2  1.6 1233236 140252 tty4   Sl   10:15   0:24 puma 3.12.1 (tcp://localhost:3000)

这里 1378 是 process_id。现在通过运行以下命令终止该进程:

kill -9 1378

重新启动服务器并再次检查。希望它会工作:)

【讨论】:

  • 感谢您的帮助,我应该没问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-10-18
  • 2021-09-29
  • 2022-07-05
  • 1970-01-01
  • 2019-03-05
  • 1970-01-01
  • 2011-02-13
相关资源
最近更新 更多