运行RAILS_ENV=production bundle exec rake assets:precompile
并推送到heroku后,我收到此错误:
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?
完整的日志在这里:http://dpaste.com/hold/1503531/
当我签入public/assets/manifest-*.json
文件时,怎么会发生这种情况?我正在使用Rails 4.0.2。
在production.rb
我有:
config.assets.compile = false
答案 0 :(得分:3)
我解决了这个问题!我添加了一个空的public/assets/manifest.yml
文件并推送到heroku,它在推送时不再尝试预编译。
Detected manifest.yml, assuming assets were compiled locally
答案 1 :(得分:1)
gem 'capistrano-rails', '~> 1.1.3'
此版本issue已在1.1.3版中修复
答案 2 :(得分:0)
确保在config.assets.initialize_on_precompile = false
中设置config/application.rb
以防止资产编译初始化完整的Rails实例。如果没有设置,Rails实例将被实例化并尝试正常启动,尝试连接到您的数据库。
config.assets.initialize_on_precompile = false
在Precompiling Assets下面的红色警告框中提到了这一点,并在它说“Heroku要求这是假的。”之前以粗体显示。“