rails 3.1.0 ActionView::Template::Error (application.css isn't precompiled)

前端 未结 14 1600
自闭症患者
自闭症患者 2020-11-27 09:02

I made a basic rails app with a simple pages controller with an index function and when I load the page I get:

ActionView::Template::Error (application.css i         


        
相关标签:
14条回答
  • 2020-11-27 09:20

    if you think you followed everything good but still unlucky, just make sure you/capistrano run touch tmp/restart.txt or equivalent at the end. I was in the unlucky list but now :)

    0 讨论(0)
  • 2020-11-27 09:22

    I ran into this error message today and wanted to post the resolution to my particular my case. It turns out that my problem was that one of my css files was missing a closing brace and this was causing the file to not be compiled. It may be harder to notice this if you have an automated process that sets everything up (including the asset precompile) for your production environment.

    0 讨论(0)
  • 2020-11-27 09:23

    Just another way to fix this up on Heroku: Make sure your Rakefile is committed and pushed.

    0 讨论(0)
  • 2020-11-27 09:28

    I was having the exact same error in my development environment. In the end all I needed to do in order to fix it was to add:

    config.assets.manifest = Rails.root.join("public/assets")
    

    to my config/environments/development.rb file and it fixed it. My final config in development related to assets looks like:

    config.assets.compress = false  
    config.assets.precompile += %w[bootstrap-alerts.js] #Lots of other space separated files
    config.assets.compile = false
    config.assets.digest = true
    config.assets.manifest = Rails.root.join("public/assets")
    config.assets.debug = true
    
    0 讨论(0)
  • 2020-11-27 09:29

    You probably have a syntax error in the css you are using.

    Run this command

    $ bundle exec rake assets:precompile RAILS_ENV=development --trace
    

    It will give the exception, fixed that and you are all done.

    Thanks

    0 讨论(0)
  • 2020-11-27 09:30

    A quick fix for capistrano user is to put this line to Capfile

    # Uncomment if you are using Rails' asset pipeline
    load 'deploy/assets'
    
    0 讨论(0)
提交回复
热议问题