为什么 Heroku 在 Rails 3.1 应用程序中跳过预编译步骤?
我正在摆弄 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: 中删除以下内容
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)
I'm messing around with a rails 3.1 app and deploying to Heroku Cedar.
When pushing an app, Heroku skips over the precompile step without throwing an error:
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
The last time I pushed to Heroku (maybe a month ago) it had no problem precompiling assets.
gem 'rails', '3.1.1.rc2', :git => 'git://github.com/rails/rails.git', :branch => '3-1-stable'
UPDATE:
I was able to get Heroku to precompile by removing the following from application.rb:
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
and replacing with:
# 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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这可能听起来很自负,但是您确定使用 -stack cedar 创建了 Heroku 应用程序吗?
I know this may sound conceiting, but did you make sure you create the Heroku app with -stack cedar?
您还可以检查链轮是否已启用,就像我一样 这里当我遇到同样的问题时。
You could also check to see that sprockets is enabled as I did here when I was having the same problem.