how to install “readline” for rails console

2019-02-19 17:36发布

问题:

ok i am trying to run "rails console" command but here's what i get:

/home/user/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
    from /home/user/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/irb/completion.rb:10
    from /home/user/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands/console.rb:3:in `require'
    from /home/user/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands/console.rb:3
    from /home/user/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:37:in `require'
    from /home/user/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:37
    from script/rails:6:in `require'
    from script/rails:6

how can I install "readline" and make it work ?

回答1:

I know it is too late.

no such file to load -- readline (LoadError)

try adding gem ’rb-readline’ to your Gemfile.)



回答2:

rvm package has been changed to rvm pkg

It would be nice if the error just told us this! Ugh!



回答3:

$ rvm uninstall 1.8.7
$ rvm package install readline
$ rvm install 1.8.7 -C –with-readline-dir=$HOME/.rvm/usr

http://blogs.law.harvard.edu/hoanga/2009/09/08/getting-ruby-191p243-to-work-on-os-x-1058-with-japanese-input-support-on-irb/