'sass' in a non thread-safe way

前端 未结 3 2043
甜味超标
甜味超标 2021-02-01 20:32

I\'m getting these warnings when trying to use sass in Rails 3.1 rc1.

WARN: tilt autoloading \'sass\' in a non thread-safe way; explicit requir         


        
相关标签:
3条回答
  • 2021-02-01 20:49

    have you tried doing this in Gemfile?

    gem "sass", :require => 'sass'
    

    this is an explicit call, without using initializers. by the way consider that you're using a rc1 release.

    0 讨论(0)
  • 2021-02-01 20:59

    On Heroku I was getting this same error and googling did not help me find the problem, so I thought I would add what I found to this questions since it comes up first when searching.

    The problem was NOT this error, it was a smaller error while pushing the code up to Heroku. After the gems are listed these lines got me on the path to the answer:

    Running: rake assets:precompile
    rake aborted!
    Tasks: TOP => environment
    (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
    

    I had just been configuring Redis on Heroku so I knew that the problem had to be something related to those changes. At that URL I found this:

    While precompiling assets, in Rails 3.1.1 and up, you can prevent initializing your application and connecting to the database by ensuring that the following line is in your > config/application.rb:

    config.assets.initialize_on_precompile = false

    Adding the on_precompile = false line fixed all the errors, including the original one in this question.

    0 讨论(0)
  • 2021-02-01 21:07

    I had the same problem, and was able to solve it by compiling assets locally before pushing to Heroku as mentioned in the article Rails 3.1+ Asset Pipeline on Heroku Cedar

    RAILS_ENV=production bundle exec rake assets:precompile
    

    I also tried Itecedors suggestion which also worked:

    While precompiling assets, in Rails 3.1.1 and up, you can prevent initializing
    your application and connecting to the database by ensuring that the following 
    line is in your > config/application.rb:
    
    config.assets.initialize_on_precompile = false
    
    0 讨论(0)
提交回复
热议问题