Couldn't find file 'jquery-ui'

后端 未结 6 1068
闹比i
闹比i 2020-12-08 09:10

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/asse

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 09:51

    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"

提交回复
热议问题