No such file to load — readLine solution after Ruby upgrade

Time:2019-10-5

Upgrade Ruby and rails and enter script/consle:

Copy codeThe code is as follows:
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to loadreadline (LoadError) 
        from /usr/local/lib/ruby/1.8/irb/completion.rb:10 
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require’ 
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules’ 
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each’ 
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules’ 
        from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup’ 
        from /usr/local/lib/ruby/1.8/irb.rb:54:in `start’ 
        from /usr/local/bin/irb:13 

Terms of settlement:

Step 1: Verify that libncurses5-dev libreadline5-dev is installed or not.

Copy codeThe code is as follows:
Suo apt-get install libncurses5-dev libreadline5-dev for installation

Step 2:

Copy codeThe code is as follows:
cd /usr/src/ruby-1.8.7/ext/readline 
ruby extconf.rb 
make 
sudo make install