简体   繁体   中英

Heroku can't find jquery.ui when using jquery-ui-rails gem in production

I'm using the jquery-ui-rails gem. It works fine on local host, but when I push to heroku it gives heroku logs shows this:

2012-04-11T02:28:59+00:00 app[web.1]: ActionView::Template::Error (couldn't find file 'jquery.ui.slider'
2012-04-11T02:28:59+00:00 app[web.1]:   (in /app/app/assets/stylesheets/application.css:12)):

My production config file:

config.cache_classes = true

config.consider_all_requests_local       = false
config.action_controller.perform_caching = true

config.serve_static_assets = true

config.assets.compress = true

config.assets.compile = true

config.assets.digest = true

Some questions online say to change config.assets.compile to false, but when I do that I get a application.css not precompiled error.

Taking the line gem jquery-ui-rails out of the assets group in the Gemfile seems to help. Similar problem/fix for the twitter bootstrap gem. :)

I had a similar, though not identical, problem. In my case, drag and drop methods worked locally, but Heroku complained that it couldn't find jquery-ui.

What solved it for me was this:

  1. In the Gemfile, added

    gem 'jquery-ui-rails'

  2. In application.js, added

    //= require jquery.ui.all

  3. In application.css, added

    * = require jquery.ui.all

Finally, of course, git commit -a -m "added jquery ui statements" , followed by git push heroku master .

You might have some sort of syntax error in some of your asset files. As the assets are precompiled different types of assets are concatenated as one. Now if one of your CSS files has a syntax error in the end of it, it might not affect anything in our local environment as the assets are not precompiled. However, when the asset files are joint together as one big file anything that then happens to follow the error would not get loaded. This might result in missing JavaScript stuff, CSS rules, etc..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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