尝试了几个修正:Heroku / Rails 4资产预编译错误 [英] Tried several fixes: Heroku/Rails 4 Assets Precompile Error
问题描述
关注 >
heroku labs:enable user-env-compile -a myapp
然后我通过运行
RAILS_ENV = production bundle exec rake assets:precompile
他们这样做。
我也跟着这个提示,设置 在我的config / production.rb和config / application.rb中。 然后我确定我的路径中有
config.assets.initialize_on_precompile = false
gem'rails_log_stdout',github:'heroku / rails_log_stdout'
gem'rails3_serve_static_assets',github:'heroku / rails3_serve_static_assets'
bin
,方法如下: this heroku article 。
我也跟着另一个答案这个问题,并将以下内容放在 application.rb
和 production.rb
config.serve_static_assets = true
这里是错误I在运行时获得
为Rails资产准备应用程序管道
运行:rake资产:预编译
rake中止!
无法连接到服务器:连接被拒绝
服务器是否在主机127.0.0.1上运行并接受端口5432上的
TCP / IP连接?
好像 config.assets.initialize_on_precompile = false
应该已经工作了,因为它看起来好像试图在预编译期间加载生产数据库。
我已经完成了所有这些更改,并且它们已被推送到掌握在 git
中。现在我该怎么办?
好吧,对此抱歉。我想我没有推过 RAILS_ENV = production bundle exec rake assets:precompile
的效果。希望这可以成为这个问题的一些资源。
编辑
为了做到这一点,我运行 RAILS_ENV =生产捆绑销售佣金资产:预编译
。然后我将它与
git add -A
git commit -m预编译资产
git push origin master
git push heroku master
Looks like this is a common issue, so let me begin by saying I've done a lot of research already.
Following this thread, I ran
heroku labs:enable user-env-compile -a myapp
Then I made sure that assets precompile locally by running
RAILS_ENV=production bundle exec rake assets:precompile
They do.
I also followed this tip, setting
config.assets.initialize_on_precompile = false
in my config/production.rb and config/application.rb.
Also, following this issue, I've made sure I have the heroku gems installed:
gem 'rails_log_stdout', github: 'heroku/rails_log_stdout'
gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'
Then I made sure I had bin
in my path by following this heroku article.
Then I made sure I followed the "Getting Started with Rails 4.x.x" article on heroku.
I've also followed another answer to this question and placed the following in application.rb
and production.rb
config.serve_static_assets = true
Here's the error I get when running git push heroku master
:
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?
It seems like config.assets.initialize_on_precompile = false
should've worked, because it seems like it's trying to load the production database during precompliation.
I've made all these changes and they've been pushed to master in git
. Now what should I try?
Well, sorry about this. I guess I hadn't pushed the effects of RAILS_ENV=production bundle exec rake assets:precompile
. Hopefully this serves as a number of resources for this issue.
Edit
In order to do this, I ran RAILS_ENV=production bundle exec rake assets:precompile
. Then I committed this with
git add -A
git commit -m "precompiled assets"
git push origin master
git push heroku master
这篇关于尝试了几个修正:Heroku / Rails 4资产预编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!