Ruby on Rails部署到Heroku时,rake assets:precompile报错,如何解决无法连接PostgreSQL的问题?

2026-04-11 15:121阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计248个文字,预计阅读时间需要1分钟。

Ruby on Rails部署到Heroku时,rake assets:precompile报错,如何解决无法连接PostgreSQL的问题?

在尝试使用git将应用程序推送到Heroku时,遇到了以下特定错误:`remote: Running: rake assets:precompile remote: PG::ConnectionBad: could not connect to server: Connection refused remote: Is the server running on host '127.0.0.1'`。这通常意味着无法连接到本地数据库服务器。

在尝试git将应用程序推送到heroku时,我得到了这个特定的错误:

remote: Running: rake assets:precompile remote: PG::ConnectionBad: could not connect to server: Connection refused remote: Is the server running on host "127.0.0.1" and accepting remote: TCP/IP connections on port 5432?

我尝试按照文章的步骤操作:https://devcenter.heroku.com/articles/rails-asset-pipeline#troubleshooting

我的资产在本地编译而无需连接到数据库.

我还添加了config.assets.initialize_on_precompile = false

但是当尝试在heroku中部署时仍然会出现错误…

我知道我做错了什么吗?

谢谢!

P.S:我正在使用带有rails 4.2.0的spree 3.0.0

在heroku中为您的应用创建新数据库:
heroku addons:创建heroku-postgresql

Ruby on Rails部署到Heroku时,rake assets:precompile报错,如何解决无法连接PostgreSQL的问题?

然后尝试git push to heroku

本文共计248个文字,预计阅读时间需要1分钟。

Ruby on Rails部署到Heroku时,rake assets:precompile报错,如何解决无法连接PostgreSQL的问题?

在尝试使用git将应用程序推送到Heroku时,遇到了以下特定错误:`remote: Running: rake assets:precompile remote: PG::ConnectionBad: could not connect to server: Connection refused remote: Is the server running on host '127.0.0.1'`。这通常意味着无法连接到本地数据库服务器。

在尝试git将应用程序推送到heroku时,我得到了这个特定的错误:

remote: Running: rake assets:precompile remote: PG::ConnectionBad: could not connect to server: Connection refused remote: Is the server running on host "127.0.0.1" and accepting remote: TCP/IP connections on port 5432?

我尝试按照文章的步骤操作:https://devcenter.heroku.com/articles/rails-asset-pipeline#troubleshooting

我的资产在本地编译而无需连接到数据库.

我还添加了config.assets.initialize_on_precompile = false

但是当尝试在heroku中部署时仍然会出现错误…

我知道我做错了什么吗?

谢谢!

P.S:我正在使用带有rails 4.2.0的spree 3.0.0

在heroku中为您的应用创建新数据库:
heroku addons:创建heroku-postgresql

Ruby on Rails部署到Heroku时,rake assets:precompile报错,如何解决无法连接PostgreSQL的问题?

然后尝试git push to heroku