已解决:使用 rvm 安装 ruby 2.0.0 和 rails 3。使用较新版本的 ruby 后,此问题消失。
当我在$ rails server
本地运行并尝试在浏览器中加载任何静态资产时,例如"localhost:3000/assets/javascripts/main.js"
,我收到以下错误:
Internal Server Error
invalid encoding ("UTF-8//IGNORE", "BINARY")
WEBrick/1.3.1 (Ruby/1.8.7/2012-02-08) at localhost:3000
这发生在所有静态资产上。这里可能是什么问题?
我正在使用Mac OS X 10.7.5
堆栈跟踪:
[2013-02-28 12:59:12] ERROR Iconv::InvalidEncoding: invalid encoding ("UTF-8//IGNORE", "BINARY")
/Library/Ruby/Gems/1.8/gems/i18n-0.6.3/lib/i18n/core_ext/string/encoding.rb:7:in `conv'
/Library/Ruby/Gems/1.8/gems/i18n-0.6.3/lib/i18n/core_ext/string/encoding.rb:7:in `force_encoding'
/Library/Ruby/Gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:41:in `escape_glob_chars'
/Library/Ruby/Gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:14:in `match?'
/Library/Ruby/Gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:56:in `call'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/engine.rb:479:in `call'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/application.rb:223:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/rack/log_tailer.rb:17:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/handler/webrick.rb:13:in `run'
/Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/commands.rb:55
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/commands.rb:50
script/rails:6:in `require'
script/rails:6