43

when trying to deploy with capistrano, when capistrano use command bundle exec rake

    RAILS_ENV=production 
    RAILS_GROUPS=assets 
    assets:precompile

I have this error

couldn't find file 'jquery-ui'
  (in /home/umbrosus/.rvm/gems/ruby-1.9.3-p392@gancxadebebi/gems/activeadmin-0.5.1/app/assets/javascripts/active_admin/base.js:2)

Before it was working well, but I tried to update to 0.6 and then I started to have this error. I came back to 0.5.1 and the error is still there. Do I do something bad ?

thanks

user2016483
  • 583
  • 1
  • 5
  • 13

6 Answers6

118

The "jquery-rails" gem recently removed jQuery UI.

https://github.com/rails/jquery-rails/commit/2fdcdb2633cbc6426d412c050200fc31d14b9a3b

They recommend using the jquery-ui-rails gem.

There is an active pull request (as of this writing) to add that gem as a dependency. However, the developers of ActiveAdmin have stated that they are "locking it down until we officially drop support for Rails 3.0". The version they are locked to is jquery-rails < 3.0.0.

In the meantime, just modify your Gemfile:

gem "jquery-ui-rails" Not recommended, see @Kevin's comment below

Or you can downgrade your version of jquery-rails:

gem "jquery-rails", "< 3.0.0"

Or you can pull from their Github master branch. They have applied a temporary fix.

gem "activeadmin", github: "gregbell/active_admin"
Jamon Holmgren
  • 23,738
  • 6
  • 59
  • 75
  • 60
    To save frustration, I'd recommend the second solution. The `gem "jquery-ui-rails"` named their `jquery-ui` file `jqueryui`, so ActiveAdmin will still have a loading error if you go that route. – Kevin May 30 '13 at 23:25
  • 2
    Downgrading "jquery-rails" to "2.3.0" fixed this issue from my end. On Rails 3.2.13, btw. – jcuervo May 31 '13 at 06:02
31

Well, there is no need to downgrade jquery-rails to 2.3.0 or specify a GitHub branch. Just use jquery-ui-rails. To workaround the file name differences:

Simply create app/assets/javascripts/jquery-ui.js

//= require jquery.ui.all

Create app/assets/stylesheets/jquery-ui.css

/*
 *= require jquery.ui.all
 */

These load the correct files to satisfy ActiveAdmin

kizzx2
  • 18,775
  • 14
  • 76
  • 83
  • I like this better, because I generally like using rubygems as a source rather than the master branch on github. – manderson Sep 06 '13 at 16:57
  • Just followed these instructions and it worked perfectly - thanks. – Richard Jordan Sep 19 '13 at 21:05
  • I liked your solution because I use other gems that depend on jquery-ui > 3.0.0 – Lucca Mordente Sep 25 '13 at 21:36
  • I like this solution as well because I need to use jquery-rails > 3.0.0 and jquery-ui-rails. However, I'm running into a dependancy issue . . . `Bundler could not find compatible versions for gem "jquery-rails": In Gemfile: activeadmin (= 0.6.1) depends on jquery-rails (< 3, >= 1.0.0) jquery-rails (3.0.4)`. How can I get around this??? – chuck w Oct 02 '13 at 16:38
  • @chuckw I have `activeadmin 0.6.0` in my `Gemfile.lock` and it doesn't have the rule `jquery-rails (<3)`. `activeadmin 0.6.0` and `jquery-rails 3.0.4` seem to coexist well for me. So try changing your ActiveAdmin line to `gem 'activeadmin', '0.6.0'` to freeze it (assume you don't need ActiveAdmin `0.6.1`'s new features)? You should probably report this to ActiveAdmin's issue tracker separately. – kizzx2 Oct 04 '13 at 05:37
  • I'm using Rails 4.0.8, and i don't have app/assets/js but app/assets/javascript. Does it matter? I tried both folder, neither worked tbh. My gemfile uses `gem 'jquery-ui-rails'` and `gem 'jquery-rails', '>=3.0.4'` – donkey Aug 18 '14 at 16:00
  • @oasisweng I think `app/assets/js` was a typo but widely understood by audience. Just checked on Rails 4.1 the actual folder name should be `app/assets/javascripts` – kizzx2 Aug 19 '14 at 17:45
11

Though the Pull request has been merged into AA by now, you will still have this problem if you work with the latest release of AA. I don't like to force JQuery-rails down to version 2.3.0 so here's an alternative solution to the problem: In the active_admin.js file replace

//= require active_admin/base

with

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

kudos to Fred for providing that solution here.

Ermias
  • 33
  • 6
kaikuchn
  • 795
  • 7
  • 15
1

Downgrading "jquery-rails" to "2.3.0" fixed this issue for me as well.

0

In my case, the jquery issue was due to a gem I was using. I wasn't using jquery directly, so adding app/assets/js/jquery-ui.js to my project didn't help.

Adding gem "jquery-rails", "< 3.0.0" to my gemfile fixed it, but I got an issue with turbolinks immediately after that, which is easy enough to fix...

My final gemfile:

# Temporary fix for jquery issue
gem "jquery-rails", "< 3.0.0"
gem 'turbolinks'

... easy peasy

Aaron Henderson
  • 1,840
  • 21
  • 20
0

I know this is already solved. But I want to give one more solution to this that worked for me.

I am running Rails 4.0.8 when having this issue.

I simply remove explicit version number for jquery-rails gem jquery-ui-rails gem.

Mine looks like this essentially:

# js
gem 'jquery-ui-rails'
gem 'jquery-rails'

# rails admin
gem 'rails_admin'

Gemfile.lock kinda figured out the correct version for all three gems automatically.

donkey
  • 4,285
  • 7
  • 42
  • 68