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

后端 未结 6 587
不知归路
不知归路 2020-12-15 20:30

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:

         


        
相关标签:
6条回答
  • 2020-12-15 21:08

    this solved the issue in heroku at least

    just downgrade to sass-rails 3.1.4

    group :assets do
      gem 'coffee-rails', '~> 3.1.1'
      gem 'uglifier', '>= 1.0.3'
      gem 'sass-rails', '3.1.4'
      gem 'bootstrap-sass', '~> 2.0.2'
    end
    
    0 讨论(0)
  • 2020-12-15 21:09

    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.

    0 讨论(0)
  • 2020-12-15 21:11

    Make sure, in config/environments/production.rb, you have...

    config.serve_static_assets = true
    
    0 讨论(0)
  • 2020-12-15 21:12

    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.

    0 讨论(0)
  • 2020-12-15 21:16

    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
    
    0 讨论(0)
  • 2020-12-15 21:19

    When you see something like this when you are deploying rails app to heroku.com

    Precompiling assets failed, enabling runtime asset compilation
    ...
    could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port xxxx?
    

    Just add this to config/application.rb

    config.assets.initialize_on_precompile = false
    
    0 讨论(0)
提交回复
热议问题