Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't find file 'jquery-ui'

I am getting the following error even if I have jquery-ui in my application.js file

couldn't find file 'jquery-ui' (in /home/jeff/work/projects/a/media/app/assets/javascripts/application.js:14)

application.js

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require jquery.validate.min

Can anybody help me?

like image 475
Sam Avatar asked Jul 24 '13 09:07

Sam


4 Answers

Use specific version of gem "jquery-rails", "~> 2.3.0" as later version of gem has deleted the ui part.

or

you can use gem "jquery-ui-rails" for jquery-ui . For more information please visit the git repository

To require all jQuery UI modules, add the following to your application.js:

for version 5.0 and more it has been changed. Please follow the link

application.js:

//= require jquery-ui

application.css:

/*
 *= require jquery-ui
 */

For lesser version than 5.0 we need to write below format

application.js:

//= require jquery.ui.all

Also add the jQuery UI CSS to your application.css:

application.css:

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

Hope this could help you

like image 65
Debadatt Avatar answered Nov 13 '22 23:11

Debadatt


I think you are using new version (your version > 2.3.0) of jquery-rails.

jQuery UI has been removed from jquery-rails gem,

  • ≤ jquery-rails v2.3.0 still have jQuery UI
  • ≥ jquery-rails v3.0.0 jQuery UI removed

Take a look this commit.

If you are using ≥ jquery-rails v3.0.0 or latest version of jquery-rails

You should use jquery-ui-rails gem for using jquery UI in rails, https://github.com/joliss/jquery-ui-rails.

In your Gemfile, add:

gem 'jquery-ui-rails'

and run bundle install

  1. v2.3.0 < your version ≤ v4.2.1

    And put this into application.js

    //= require jquery.ui.all
    

    then put this into application.css

    *= require jquery.ui.all
    
  2. ≥ jquery-ui-rails v5.0.0 or latest version

    And put this into application.js

    //= require jquery-ui
    

    then put this into application.css

    *= require jquery-ui
    

    or to use specific modules read this

Don't forget restart your server.

If you are using ≤ jquery-rails v2.3.0

see my answer here https://stackoverflow.com/a/16996710/1297435 for use gem 'jquery-rails', "~> 2.3.0"

like image 28
rails_id Avatar answered Nov 14 '22 00:11

rails_id


The rails 4 answer:

add to gemfile.rb:

gem 'jquery-ui-rails'

add to application.js:

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

to add a specific module:

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

I'm not sure if restarting your server is explicitly required but it never hurts anything.

like image 9
Joe Susnick Avatar answered Nov 13 '22 23:11

Joe Susnick


I know its a noob mistake but I found this very frustrating and always forget to restart my app after I have installed something new.

Make sure to restart your rails server after you have followed the instructions above and it should work perfectly.

like image 4
doz87 Avatar answered Nov 14 '22 01:11

doz87