Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't find file 'twitter/bootstrap' in Production

I'm using Twitter's Bootstrap translated to SCSS files. It works in local-development, but when I precompile and push to Heroku (using Cedar stack), I get this:

> Started GET "/" for 74.57.16.130 at 2012-01-28 17:16:36 +0000 
> Processing by StaticPagesController#home as HTML  Rendered
> static_pages/home.html.erb within layouts/application (0.7ms) 
> Completed 500 Internal Server Error in 4ms
> 
>  ActionView::Template::Error (couldn't find file 'twitter/bootstrap'  
> (in /app/app/assets/stylesheets/application.scss.css:11)):
>      8: </head>
>      6:   <%= javascript_include_tag "application" %>
>      4:   <title><%= full_title(yield(:title)) %></title>
>      2: <html>
>      5:   <%= stylesheet_link_tag    "application", :media => "all" %>        
app/views/layouts/application.html.erb:5:in
> `_app_views_layouts_application_html_erb___288948710373692320_32137840'
>      3: <head>    cache: [GET /] miss
> 
>      7:   <%= csrf_meta_tags %>  cache: [GET /favicon.ico] miss

I'm using Rails 3.2.0, the app was working on Heroku until I added the SASS files.

like image 622
johncho Avatar asked Jan 28 '12 17:01

johncho


3 Answers

Are you using a gem? Make sure your gem is not part of the assets group and is accessible in production.

From GemFile

# Gems used only for assets and not in production environments by default.

So just move the gem outside of any group and you should be okay.

like image 50
mike Avatar answered Nov 12 '22 11:11

mike


Just put this in your gemfile

gem "twitter-bootstrap-rails", "~> 2.0rc0"

There's invalid CSS in BootStrap 2.0 which causes SCSS compilation to fail

You can verify this by looking at the output of

git push heroku master 

You should see some error like:

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       Invalid CSS after "...er-radius:0 \0/": expected expression (e.g. 1px, bold), was ";}"
       (in /tmp/build_1k8ugei34dpcw/app/assets/stylesheets/application.css)

       Tasks: TOP => assets:precompile:primary
       (See full trace by running task with --trace)
       Precompiling assets failed, enabling runtime asset compilation
       Injecting rails31_enable_runtime_asset_compilation
       Please see this article for troubleshooting help:
       http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
like image 40
Doug Avatar answered Nov 12 '22 09:11

Doug


In config/environments/production.rb add this line:

config.assets.precompile = [/^[-_a-zA-Z0-9]*\..*/]

My guess is it is not adding all your assets.

like image 3
Mitch Dempsey Avatar answered Nov 12 '22 09:11

Mitch Dempsey