Help us understand the problem. What is going on with this article?

pry起動時にエラーが出た場合の対処法

More than 3 years have passed since last update.

pryを起動しようとしたところ、下記のエラーが出力された。
環境:Ubuntu

$ pry
Sorry, you can't use Pry without Readline or a compatible library.
Possible solutions:
 * Rebuild Ruby with Readline support using `--with-readline`
 * Use the rb-readline gem, which is a pure-Ruby port of Readline
 * Use the pry-coolline gem, a pure-ruby alternative to Readline
/home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- readline (LoadError)
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/config/default.rb:151:in `lazy_readline'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/config/default.rb:6:in `block in <class:Default>'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/config/default.rb:125:in `instance_eval'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/config/default.rb:125:in `block (2 levels) in <class:Default>'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/config/behavior.rb:54:in `public_send'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/config/behavior.rb:54:in `method_missing'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/history.rb:19:in `restore_default_behavior'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/history.rb:14:in `initialize'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_class.rb:33:in `new'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_class.rb:33:in `history'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_class.rb:222:in `load_history'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_class.rb:129:in `initial_session_setup'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/cli.rb:206:in `block in <top (required)>'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/cli.rb:83:in `call'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/cli.rb:83:in `block in parse_options'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/cli.rb:83:in `each'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/cli.rb:83:in `parse_options'
    from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/bin/pry:16:in `<top (required)>'
    from /home/vagrant/.rbenv/versions/2.1.1/bin/pry:23:in `load'
    from /home/vagrant/.rbenv/versions/2.1.1/bin/pry:23:in `<main>'  

どうやら、Readlineというのがないみたい。
なので、インストール。

$ gem install rb-readline
Fetching: rb-readline-0.5.2.gem (100%)
Successfully installed rb-readline-0.5.2
Parsing documentation for rb-readline-0.5.2
Installing ri documentation for rb-readline-0.5.2
Done installing documentation for rb-readline after 1 seconds
1 gem installed

起動するでしょうか。。。

$ pry
[1] pry(main)>

やった :laughing:

KanakoKobayashi
中学生、高校生のためのプログラミング・ITキャンプ/スクール展開している、ライフイズテック株式会社でエンジニアしています。 待望のRailsでの開発ができて、嬉しい日々です。 2015年中に、iOSアプリをリリースするのが目標です。 プライベートでは、Ruby/Rails、Swift、WordPressの勉強会を主催しています。
lifeistech
中高生向けのプログラミング・IT教育プログラム「Life is Tech!(ライフイズテック)」を企画・運営するスタートアップ
https://life-is-tech.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした