在newoku上预编译失败,并将initialize_on_precompile设置为false

时间:2012-08-09 17:50:23

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-3.1 heroku

我有一个应用程序,我正在尝试部署到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
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       could not connect to server: Connection refused
       Is the server running on host "127.0.0.1" and accepting
       TCP/IP connections on port 5432?
       Tasks: TOP => environment
       (See full trace by running task with --trace)
       Precompiling assets failed, enabling runtime asset compilation

通常我可以通过添加

来解决这个问题
config.assets.initialize_on_precompile = false

config/initializers/production.rb,如Heroku docs

中所述

这次似乎没有解决问题。我还能尝试什么?

这是我的Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.7'

gem 'jquery-rails'
gem 'mini_magick'
gem 'fog'
gem 'carrierwave'
gem 'mail_form'
gem 'client_side_validations'
gem 'remotipart', '~> 1.0'
gem 'thin'

group :production do
  gem 'pg'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

group :development do
  gem 'heroku'
  gem 'mailcatcher'
end

group :development, :test do
  gem 'rspec-rails'
  gem 'sqlite3'
end

group :test do
  gem 'capybara-webkit'
  gem 'database_cleaner'
  gem 'factory_girl_rails'
  gem 'database_cleaner'
end

1 个答案:

答案 0 :(得分:5)

你试过这个Heroku实验室吗?

https://devcenter.heroku.com/articles/labs-user-env-compile

最近刚刚遇到它,并且没有机会尝试,但是下次资产编译总是失败时会这样做......

这里还有一篇博文:

http://blog.genuitytech.com/2012/01/31/heroku-labs-and-user-env-compile/