hack のためのネタ帳, etc,,,

Troubleshooting

以下の構成で UTF-8 環境だと、以下のように invalid byte sequence in UTF-8 が出て腐る。
$ uname -a
CYGWIN_NT-6.1 xxxxxxxxxxx 1.7.27(0.271/5/3) 2013-12-09 11:54 x86_64 Cygwin
$ ruby -v
ruby 2.0.0p353 (2013-11-22) [x86_64-cygwin]
$ gem -v
2.2.2
$ gem --debug search vagrant

*** REMOTE GEMS ***

Exception `NameError' at /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/fiddle/import.rb:153 - uninitialized constant Fiddle::Function::STDCALL
Exception `ArgumentError' at /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:173 - invalid byte sequence in UTF-8
ERROR:  While executing gem ... (ArgumentError)
    invalid byte sequence in UTF-8
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:173:in `tr'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:173:in `initialize'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:231:in `exception'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:231:in `raise'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:231:in `check'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:284:in `QueryValue'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:587:in `read'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:637:in `read_s'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/resolv.rb:72:in `block in get_info'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:389:in `open'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/registry.rb:496:in `open'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/resolv.rb:62:in `get_info'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/win32/resolv.rb:20:in `get_resolv_info'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:928:in `default_config_hash'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:945:in `block in lazy_initialize'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:938:in `synchronize'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:938:in `lazy_initialize'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:357:in `block in lazy_initialize'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:355:in `synchronize'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:355:in `lazy_initialize'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:509:in `each_resource'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:490:in `getresource'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/remote_fetcher.rb:88:in `api_endpoint'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/source.rb:42:in `api_uri'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/source.rb:170:in `load_specs'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:266:in `tuples_for'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:226:in `block in available_specs'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/source_list.rb:97:in `each'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/source_list.rb:97:in `each_source'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:222:in `available_specs'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:147:in `detect'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/commands/query_command.rb:167:in `show_gems'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/commands/query_command.rb:109:in `block in execute'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/commands/query_command.rb:109:in `each'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/commands/query_command.rb:109:in `execute'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/command.rb:305:in `invoke_with_build_args'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/command_manager.rb:167:in `process_args'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/command_manager.rb:137:in `run'
        /home/kou/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:54:in `run'
        /home/kou/.rbenv/versions/2.0.0-p353/bin/gem:21:in `<main>'
これは、以前以下の件で遭遇した問題がモロに顕在化してる模様。 なので、気持ち悪いけど LANG=ja_JP.SJIS にしとくと、とりあえずは動く。
いや、でもやっぱり気持ち悪い。

参考: 追記: 2014-03-18:
Ruby 2.1.0 以降のバージョンで解決済みなので、そちらを使う方が良さそう。

関連

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

フリーエリア

編集にはIDが必要です