升級到ruby 1.9.3後,我的其中一個應用工作正常,但我試圖轉換的第二個失敗是「assets:precompile」階段部署與capistrano。 這裏是堆棧跟蹤:rake任務失敗,US-ASCII中的字節序列無效
rake aborted!
rake aborted!
invalid byte sequence in US-ASCII
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/trace_output.rb:16:in `block in trace_on'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/trace_output.rb:14:in `map'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/trace_output.rb:14:in `trace_on'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:328:in `trace'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:183:in `display_error_message'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:169:in `rescue in standard_exception_handling'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:159:in `standard_exception_handling'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/george/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/Users/george/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `eval'
/Users/george/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `<main>'
我看過無數的帖子,並嘗試了幾種建議,但都無濟於事。 我嘗試添加以下到我的Gemfile的頂部:
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
但它並沒有區別。
我檢查LANG和LC_ALL環境變量如下
$ echo $LC_ALL
en_NZ.UTF-8
$ echo $LANG
en_NZ.UTF-8
我怕我真的不知道該消息的一切,我不知道如何識別有問題的文件。
我不能得到任何rake任務運行 - 它給出了同樣的錯誤。
請注意,我可以在開發模式下完美地運行應用程序。
隨機搜索項目中的文件後。我決定,因爲錯誤消息沒有指定問題的文件名,那麼它可能是與耙自己的事情。刪除包含用於數據庫啓動的硬編碼數據的rake任務可以解決問題。 – giorgio 2013-04-11 22:06:20