1
$ rake assets:precompile
rake aborted!
could not connect to server: Network is unreachable
    Is the server running on host "192.168.163.70" and accepting
    TCP/IP connections on port 5432?

(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/local/Cellar/ruby/1.9.3-p0/bin/ruby /...]

所以我试图在我的开发箱上预编译资产。出于某种原因,它尝试连接到生产数据库 (192.168.163.70),如果连接失败,它就会中止。

为什么它会这样做,我该如何解决这个问题?

4

2 回答 2

1

我的 Rake 任务文件之一中有以下行

require File.expand_path(File.join(File.dirname(__FILE__), '../..', 'config', 'environment'))

删除它解决了这个问题。

于 2011-12-21T08:28:28.897 回答
0

检查您的 RAILS_ENV,它现在必须设置为production

于 2011-12-21T08:16:35.417 回答