Rails console not working even after updates - ruby-on-rails

I am trying to run rails console. I have tried everything suggested on SO. I have libreadline-6 installed. My ruby version is 2.1.1 and irb is 0.9.6.
/home/xamroc/.rbenv/versions/2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /home/xamroc/.rbenv/versions/2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
from /home/xamroc/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands/console.rb:3:in `require'
from /home/xamroc/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/xamroc/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:51:in `require'
from /home/xamroc/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:51:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Any suggestions?
Also, I am using rbenv to manage my ruby versions.

You need to install libreadline and also the -dev package and then you need to recompile ruby. When your using rvm you should always run
rvm requirements
first and then download and compile ruby. If your using rvm then you can run
rvm reinstall <version>
to do this.
// Also see: http://vvv.tobiassjosten.net/ruby/readline-in-ruby-with-rbenv/

Related

My error when I setup rails with M1 and ruby 3.1.2?

I am trying to setup Rails and here is my problem.
My ruby version is 3.1.2(when I checked by command ruby -v)
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
But when I ran some codes like rails -v or rails -s, it always gave me this error
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': incompatible library version - /Users/anhbui/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap/bootsnap.bundle (LoadError)
from /Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap/compile_cache/iseq.rb:3:in `<top (required)>'
from /Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap/compile_cache.rb:16:in `require_relative'
from /Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap/compile_cache.rb:16:in `setup'
from /Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap.rb:55:in `setup'
from /Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap.rb:97:in `default_setup'
from /Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.14.0/lib/bootsnap/setup.rb:5:in `<top (required)>'
from /Users/xxx/Desktop/Rails/freelancer/config/boot.rb:4:in `require'
from /Users/xxx/Desktop/Rails/freelancer/config/boot.rb:4:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
So, how can I fix this one ?
My setup is
ruby 3.1.2
yarn 1.22.19
node 19.0.1
rails 6.1.x (maybe)
Thank you in advance!
Not sure what is the bug here but I faced the same issue and I solved it by completely uninstalling brew and reinstalling it back.
I got the suggestion from here: https://github.com/Shopify/bootsnap/issues/352

Ruby loading required items error

I'm trying to run the script from "HOW TO RUN YOUR OWN BITCOIN ARBITRAGE BOT".
You can try following it yourself and test the results.
I followed it exactly and yet, when I open the program, I get this and I have no idea how to fix it.
c:\Ruby200-x64\devkit>rbtc_simple
C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require
': cannot load such file -- bundler (LoadError)
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:5
5:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rbtc_arbitrage_simple-2.1.1
/lib/rbtc_arbitrage.rb:1:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:5
5:in `require'
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:5
5:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rbtc_arbitrage_simple-2.1.1
/bin/rbtc_simple:4:in `<top (required)>'
from C:/Ruby200-x64/bin/rbtc_simple:23:in `load'
from C:/Ruby200-x64/bin/rbtc_simple:23:in `<main>'
I'm running 64bit Ruby and 64bit devkit.
I ran git init in C:\Ruby200\bin, which I think is the right folder. How can I know where to run it?
You are missing the bundler gem as seen in your error message:
require: cannot load such file -- bundler
to fix this you can install bundler to your gems: gem install bundler

Rails console is not working - rails c

I've reinstalled the Ruby version a bunch of times, but I couldn't find why, when I go to the terminal and type rails c, it throws this error:
.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /Users/cleytonmessias/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/completion.rb:9:in `<top (required)>'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247#trustvox/gems/railties-4.0.3/lib/rails/commands/console.rb:3:in `require'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247#trustvox/gems/railties-4.0.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247#trustvox/gems/railties-4.0.3/lib/rails/commands.rb:51:in `require'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247#trustvox/gems/railties-4.0.3/lib/rails/commands.rb:51:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I'm on Mac OSX Mavericks, Ruby-2.0.0-p247 and Rails 4.
I finally found a reference that helped me.
Using this link:
brew install readline
brew link readline
I went to file ~/.rvm/user/db and add the following line: ruby_configure_flags=--with-readline-dir=/usr/local/opt/readline
rvm reinstall 2.0.0-p247 --with-openssl-dir=/usr/local
Now when I type rails c it's working again :)

Rails console doesn't work

I installed ruby 2.0.0 and rails 4.0.0 on my Opensuse but rails console doesn't work.
I have this error message:
/home/zellou_i/.rubies/ruby-2.0.0-p247/lib64/ruby/2.0.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /home/zellou_i/.rubies/ruby-2.0.0-p247/lib64/ruby/2.0.0/irb/completion.rb:9:in `<top (required)>'
from /home/zellou_i/.gem/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:3:in `require'
from /home/zellou_i/.gem/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/zellou_i/.gem/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:53:in `require'
from /home/zellou_i/.gem/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:53:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I don't understand, I installed readline but he can't load it.
Ruby needs to be compiled with readline-support. Make sure you install libreadline6 and its dev headers (debian-specific packages, adapt to suse) and then recompile your ruby.

Aptana plugin Debug rails project

I'm tring to debug a rails project using aptana studio 3 pluging
I've run the command
gem install ruby-debug-ide
When i select Debug Server of the contextual menu of the project i get:
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require': /usr/local/rvm/gems/ruby-1.9.3-p194#miGemSet/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /usr/local/rvm/gems/ruby-1.9.3-p194#miGemSet/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194#miGemSet/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194#miGemSet/gems/ruby-debug-ide-0.4.17.beta9/lib/ruby-debug-ide.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194#miGemSet/gems/ruby-debug-ide-0.4.17.beta9/bin/rdebug-ide:17:in `require_relative'
from /usr/local/rvm/gems/ruby-1.9.3-p194#miGemSet/gems/ruby-debug-ide-0.4.17.beta9/bin/rdebug-ide:17:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194#miGemSet/bin/rdebug-ide:19:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194#miGemSet/bin/rdebug-ide:19:in `<main>'
By the way my O.S is Fedora 16
Any of you knows what that means?
Thanks in advance.
I was having the same issue with Ubuntu 12.04, and did 2 things:
1- Sent an e-mail asking for help.
2- Install RubyMine
On both results the issue is some gems that are missing.
linecache19 (0.5.13 from http://rubyforge.org/frs/?group_id=8883&release_id=46302)
ruby-debug-base19x (gem install ruby-debug-base19x --pre)
ruby-debug-ide (gem install ruby-debug-ide --pre)
Thanks to Denis Usahkov for the help :D
I donwloaded the gems from the link above (http://rubyforge.org/frs/?group_id=8883&release_id=46302), then I did the following:
rvm fetch 1.9.3
gem install ~/Downloads/linecache19-0.5.13.gem
gem install ~/Downloads/ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/home/bruno.medeiros/.rvm/src/ruby-1.9.3-p194/
The server started properly, but the Aptana don't stop on break points yet.

Resources