LoginSignup
3
0

More than 5 years have passed since last update.

irb起動がrbreadline.rbで失敗する

Posted at

問題

irbでEncoding.default_externalの設定変更や、日本語文字を含む正規表現などを試していたあと、irbがエラーで起動できなくなった。

C:\WINDOWS\system32>irb
C:/Ruby24-x64/lib/ruby/site_ruby/rbreadline.rb:6135:in `delete': invalid byte sequence in UTF-8 (ArgumentError)
        from C:/Ruby24-x64/lib/ruby/site_ruby/rbreadline.rb:6135:in `alloc_history_entry'
        from C:/Ruby24-x64/lib/ruby/site_ruby/rbreadline.rb:6168:in `add_history'
        from C:/Ruby24-x64/lib/ruby/site_ruby/readline.rb:368:in `<<'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:76:in `block (2 levels) in load_history'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:76:in `each'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:76:in `block in load_history'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:75:in `open'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:75:in `load_history'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:65:in `extended'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:21:in `extend'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:21:in `init_save_history'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:45:in `save_history='
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/context.rb:92:in `initialize'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb.rb:412:in `new'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb.rb:412:in `initialize'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb.rb:383:in `new'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb.rb:383:in `start'
        from C:/Ruby24-x64/bin/irb.cmd:19:in `<main>'

解決

~/.irb_history から、日本語文字が含まれる行を削除したら起動できるようになった。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0