【问题标题】:Why is Heroku skipping precompile step in Rails 3.1 app?为什么 Heroku 在 Rails 3.1 应用程序中跳过预编译步骤?
【发布时间】:2011-10-02 18:57:59
【问题描述】:

我正在使用 Rails 3.1 应用程序并部署到 Heroku Cedar。

推送应用时,Heroku 会跳过预编译步骤而不会抛出错误:

Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Rails plugin injection
       Injecting rails_log_stdout
       Injecting rails3_serve_static_assets
-----> Discovering process types
       Procfile declares types      -> (none)
       Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size is 16.2MB
-----> Launching... done, v35

我上次推送到 Heroku 时(可能是一个月前)预编译资产没有问题。

gem 'rails', '3.1.1.rc2', :git => 'git://github.com/rails/rails.git', :branch => '3-1-stable'

更新:

通过从 application.rb 中删除以下内容,我能够让 Heroku 进行预编译:

 if defined?(Bundler)
   # If you precompile assets before deploying to production, use this line
   Bundler.require *Rails.groups(:assets => %w(development test))
   # If you want your assets lazily compiled in production, use this line
   # Bundler.require(:default, :assets, Rails.env)
 end

并替换为:

# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require *Rails.groups(:assets) if defined?(Bundler)

【问题讨论】:

  • 这似乎对我有用。推送到heroku仍然说有错误,但页面加载正确。

标签: heroku ruby-on-rails-3.1


【解决方案1】:

我知道这听起来可能有些自负,但您是否确保使用 -stack cedar 创建 Heroku 应用程序?

【讨论】:

  • heroku stack aspen-mri-1.8.6 bamboo-mri-1.9.2 bamboo-ree-1.8.7 * cedar (beta)
【解决方案2】:

您还可以检查是否启用了 sprockets,就像我遇到相同问题时所做的 here

【讨论】:

    猜你喜欢
    • 2013-08-09
    • 1970-01-01
    • 2014-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-19
    • 1970-01-01
    相关资源
    最近更新 更多