Ruby 1.9.2 and Rails 3 cannot open rails console

前端 未结 10 1958
野性不改
野性不改 2020-12-01 06:04
[gkaykck@main myApplication]$ rails console
/usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `require\': no such file to load -- readline (LoadError)
    from /usr/l         


        
相关标签:
10条回答
  • 2020-12-01 06:35

    If you're using RVM you can re-make readline. This fixed the issue for me. Instructions here:

    no such file to load -- readline (Load Error)

    0 讨论(0)
  • 2020-12-01 06:35

    use rvm remove to remove all ruby installed. do a "which ruby" if you still get something, you need to reinstall rvm then install ruby using rvm.

    0 讨论(0)
  • 2020-12-01 06:42

    Recipe for those who use rvm:

    rvm pkg install readline
    rvm remove 1.9.3
    rvm install 1.9.3 --with-readline-dir=$rvm_path/usr
    

    In more details about it on https://rvm.io/packages/readline/

    0 讨论(0)
  • 2020-12-01 06:42

    If you want another solution to this problem do this.

    sudo apt-get install libreadline6
    

    Then in your gem file add:

    gem 'rb-readline'
    

    Then

    bundle install
    

    And you should be all set.

    0 讨论(0)
  • 2020-12-01 06:42

    Solution is to go to the source folder you compiled ruby => ext => readline than

    ruby extconf.rb
    make
    sudo make install
    
    0 讨论(0)
  • 2020-12-01 06:46

    Apparently ubuntu and ruby don't always catch dependencies like they should.

    From the first google hit (yeah, I clicked on this stack-overflow in place #2 before checking out the first result.)

    Navigate to the Ruby source and enter:

    sudo apt-get install libreadline5-dev
    cd ext/readline
    ruby extconf.rb
    make
    sudo make install
    

    So, if you're on another distro, make sure you install readline somehow (source/package), then run make/install on extconf from the source. I tried what gkaykck suggested of course but got this without readline already on my system.

    $ ruby extconf.rb
    checking for tgetnum() in -lncurses... no
    checking for tgetnum() in -ltermcap... no
    checking for tgetnum() in -lcurses... no
    checking for readline/readline.h... no
    checking for editline/readline.h... no
    
    0 讨论(0)
提交回复
热议问题