2013-01-22 20 views
5

にバグのためのボタンを押したときに、この問題が断続的ですが、上向きの矢印を押すと、前に入力したコマンドを取得する私のようなエラーが発生します:Railsのスクリプト/コンソールがクラッシュ私はreadlineの

/Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/whiny_nil.rb:52:in `method_missing': undefined method `force_encoding' for nil:NilClass (NoMethodError) 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:3801:in `_rl_col_width' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:2944:in `update_line' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:3486:in `block in rl_redisplay' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:3481:in `each' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:3481:in `rl_redisplay' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:4618:in `_rl_internal_char_cleanup' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:4679:in `readline_internal_charloop' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:4743:in `readline_internal' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:4765:in `readline' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/readline.rb:40:in `readline' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/input-method.rb:115:in `gets' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:139:in `block (2 levels) in eval_input' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:273:in `signal_status' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:138:in `block in eval_input' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:188:in `call' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:188:in `buf_input' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:103:in `getc' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/slex.rb:205:in `match_io' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/slex.rb:75:in `match' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:286:in `token' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:262:in `lex' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:233:in `block (2 levels) in each_top_level_statement' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:155:in `eval_input' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:70:in `block in start' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:69:in `catch' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:69:in `start' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>' 

問題がreadlineにあるようですか?問題を解決するには?

:解答ごとに rvm pkg install readlineを更新した後に新しいエラー:

  • RB-のreadline(0.4.2)

更新bundle listによると、私はreadlineのこのバージョンを持っています

>/Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:2730:in `[]': no implicit conversion from nil to integer (TypeError) 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:2730:in `update_line' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:3486:in `block in rl_redisplay' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:3481:in `each' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:3481:in `rl_redisplay' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:4618:in `_rl_internal_char_cleanup' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:4679:in `readline_internal_charloop' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:4743:in `readline_internal' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/rbreadline.rb:4765:in `readline' 
    from /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rb-readline-0.4.2/lib/readline.rb:40:in `readline' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/input-method.rb:115:in `gets' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:139:in `block (2 levels) in eval_input' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:273:in `signal_status' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:138:in `block in eval_input' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:188:in `call' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:188:in `buf_input' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:103:in `getc' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/slex.rb:205:in `match_io' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/slex.rb:75:in `match' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:286:in `token' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:262:in `lex' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:233:in `block (2 levels) in each_top_level_statement' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:155:in `eval_input' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:70:in `block in start' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:69:in `catch' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb.rb:69:in `start' 
    from /Users/me/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>' 

そして、私はまだ古いエラーを受けています。

+0

あなたのシステムのreadlineをチェックするべきだと思います。 –

答えて

4

明らかにrb-readlineに問題があります。

私は通常、RVMパッケージとしてのreadlineをインストール:

rvm pkg install readline 

そして、私のGemfileに任意のreadlineの特定のものを使用していません。私はこの今日遭遇

Problems with the rails console, RVM and readline

+0

その行を実行し、新しいエラーを得ました(上記を参照) – babonk

+0

私のためにトリックをしました。 –

0

あなたも見ていることがあります。

これは、readlineがコンソール行のテキストの一部を解析しようとしているためです。一部のテキストはうまく再生されません。

なぜアップキーですか?

これは、変数を設定するために「stuff」の負荷を貼り付けた後に発生しました。私は明らかにコンソールがクラッシュしたので、貼り付けに何か間違っていた。

何かクラッシュした後、すべてのITプロフェッショナルは何をしますか?もう一回やってみよう。あなたがレールコンソールに書いた最後のコマンドを試す最速の方法は何ですか?アップキー。

この問題を回避するには、アップキーを押したり、履歴を消去して問題の行を削除したりしないでください。

関連する問題