简体   繁体   English

无法在Ruby on Rails上安装Active Admin:“Sprockets :: FileNotFound ......”

[英]Can't install Active Admin for Ruby on Rails: “Sprockets::FileNotFound…”

I installed a new rails app locally, then added the active admin gem and ran rake db:migrate and then the installas per the instructions. 我在本地安装了一个新的rails应用程序,然后添加了活动的admin gem并运行了rake db:migrate,然后根据说明运行了installas。 I'm also using powder. 我也在用粉末。

When trying to access the admin area at mysite.dev/admin, I get the following: 当尝试访问mysite.dev/admin的管理区域时,我得到以下内容:

Sprockets::FileNotFound in Active_admin/devise/sessions#new Sprockets :: FileNotFound在Active_admin / devise / sessions#new中

couldn't find file 'jquery-ui' (in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activeadmin-0.6.0/app/assets/javascripts/active_admin/base.js:2) 找不到文件'jquery-ui'(在/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activeadmin-0.6.0/app/assets/javascripts/active_admin/base.js:2 )

What on earth am I doing wrong? 我究竟做错了什么?

You should set in your gem file : gem 'jquery-rails', "2.3.0" to fix the jquery-rails gem version to 2.3.0 The last update ( 3.0.0) remove the jquery-ui files and cause that issue : 你应该在你的gem文件中设置:gem'jquery-rails',“2.3.0”将jquery-rails gem版本修复为2.3.0最后一次更新(3.0.0)删除jquery-ui文件并导致该问题:

couldn't find file 'jquery-ui' (in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activeadmin-0.6.0/app/assets/javascripts/active_admin/base.js:2)

That should fix your issue for now. 那应该解决你现在的问题。 You can also get the last version of Active Admin from github that fixes your issue. 您还可以从github获取最新版本的Active Admin来修复您的问题。

But I would advice to change 但我建议改变

gem jquery-rails 

in your gemfile to : 在你的gemfile中:

gem 'jquery-rails', "2.3.0"

Hope that helps ! 希望有所帮助!

I've updated to last version (0.6.0) and I had the same problem. 我已经更新到上一个版本(0.6.0),我遇到了同样的问题。
Instead of downgrade my jquery-rails or install the gem directly from github, I change //= require active_admin/base in my in active_admin.js for: 而不是降级我的jquery-rails或直接从github安装gem,我在active_admin.js中更改//= require active_admin/base for:

//= require jquery
//= require jquery_ujs
//= require jquery.ui.core
//= require jquery.ui.widget
//= require jquery.ui.datepicker
//= require active_admin/application

When you run: 当你运行:

rails generate active_admin:assets

it generates: 它产生:

/app/assets/javascripts/active_admin.js

That file contains only one line which is to pull in the base js file from the Gem: 该文件只包含一行从Gem中提取基本js文件:

//= require active_admin/base

active_admin/base (in the Gem) is only 4 lines, one of which is causing the problem: active_admin / base(在Gem中)只有4行,其中一行导致了问题:

//= require jquery
//= require jquery-ui
//= require jquery_ujs

//= require active_admin/application

The workaround I chose is to change the contents of your project's /app/assets/javascripts/active_admin.js: 我选择的解决方法是更改​​项目的/app/assets/javascripts/active_admin.js的内容:

//= require jquery
//= require jquery.ui.all
//= require jquery_ujs

//= require active_admin/application

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM