Heroku ignores public/assets/manifest-*.json

ε祈祈猫儿з 提交于 2019-12-13 04:50:06

问题


After running RAILS_ENV=production bundle exec rake assets:precompile and pushing to heroku, I get this error:

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?

The complete log is here: http://dpaste.com/hold/1503531/

How can this happen when I have a public/assets/manifest-*.json file checked in? I'm using Rails 4.0.2.

In my production.rb I have:

config.assets.compile = false

回答1:


I fixed the issue! I added an empty public/assets/manifest.yml file and pushed to heroku, and it no longer attempted the precompile while pushing.

Detected manifest.yml, assuming assets were compiled locally



回答2:


gem 'capistrano-rails', '~> 1.1.3'

this issue is fixed in version 1.1.3




回答3:


Make sure you set config.assets.initialize_on_precompile = false in config/application.rb to prevent asset compilation from initializing a full Rails instance. If that is left unset, the Rails instance will be instantiated and try to start like normal, trying to connect to your database.

config.assets.initialize_on_precompile = false

This is mentioned in the red alert box under Precompiling Assets and in bold just before it says, "Heroku requires this to be false.".



来源:https://stackoverflow.com/questions/20555906/heroku-ignores-public-assets-manifest-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!