Rails console doesn't work - ruby-on-rails

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.

Related

Not loading library : rubygems/core_ext/kernel_require

Searched before posting, I could not able to fix the issue and I'm getting the following library errors and I'm not sure how to fix this and I don't have Ruby background so be gentle with me.
on my machine I have openssl version is : LibreSSL 2.8.3
Any help please?
/Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin16/digest/sha1.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (LoadError)
Refere
nced from: /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin16/digest/sha1.bundle
Reason: image not found - /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin16/digest/sha1.bundle
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/john.doe/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/source/git.rb:4:in `<top (required)>'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/john.doe/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/lockfile_parser.rb:122:in `<class:LockfileParser>'
from /Users/john.doe/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/lockfile_parser.rb:14:in `<module:Bundler>'
from /Users/john.doe/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/lockfile_parser.rb:13:in `<top (required)>'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/john.doe/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/definition.rb:2:in `<top (required)>'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/john.doe/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler.rb:129:in `definition'
from /Users/john.doe/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler.rb:95:in `setup'
from /Users/john.doe/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/setup.rb:9:in `<top (required)>'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from /Users/john.doe/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
The problem is that Ruby can't find the version of OpenSSL that it was compiled with. Reinstall OpenSSL (through whatever means you care to, e.g., brew install openssl), then reinstall Ruby:
rvm uninstall 2.3.1
rvm install 2.3.1
Once Ruby has been reinstalled, install your gems:
bundle install
Then retry your operation.

Rails error : active_support/core_ext/string (LoadError)

I installed Spree commerce for a website I'm making and needed to upgrade my Ruby version to 2.3.0 I've installed rvm and made the 2.3.0 the default ruby version to use.
I've re-installed Rails and Bundler but when I try to make to add the spree gem to my file using this formula:
spree install --auto-accept
then I get this error :
/Users/steph/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- active_support/core_ext/string (LoadError)
from /Users/steph/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/steph/.rvm/gems/ruby-2.3.0/gems/spree_cmd-3.0.8/lib/spree_cmd/installer.rb:2:in `<top (required)>'
from /Users/steph/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/steph/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/steph/.rvm/gems/ruby-2.3.0/gems/spree_cmd-3.0.8/lib/spree_cmd.rb:13:in `<top (required)>'
from /Users/steph/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/steph/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/steph/.rvm/gems/ruby-2.3.0/gems/spree_cmd-3.0.8/bin/spree:2:in `<top (required)>'
from /Users/steph/.rvm/gems/ruby-2.3.0/bin/spree:22:in `load'
from /Users/steph/.rvm/gems/ruby-2.3.0/bin/spree:22:in `<main>'
from /Users/steph/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/steph/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
I'm really not sure what to do, i've tried re-installing bundler and rails et spree but nothing different.
I've been following these instructions : https://guides.spreecommerce.com/developer/getting_started_tutorial.html
Can anyone help me with this error? Thanks in advance!

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 :)

Unable to open the rails console

Unable to open the rails console, throws the following error
$ rails c
/home/#/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /home/#/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/irb/completion.rb:9:in `<top (required)>'
from /home/#/.rvm/gems/ruby-2.0.0-p0#aer-ui/gems/railties-3.2.13/lib/rails/commands/console.rb:3:in `require'
from /home/#/.rvm/gems/ruby-2.0.0-p0#aer-ui/gems/railties-3.2.13/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/#/.rvm/gems/ruby-2.0.0-p0#aer-ui/gems/railties-3.2.13/lib/rails/commands.rb:38:in `require'
from /home/#/.rvm/gems/ruby-2.0.0-p0#aer-ui/gems/railties-3.2.13/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
You need to have the readline libraries installed when you compile Ruby.
Follow this blog:
fixing-readline-for-the-ruby-on-rails-console

Ruby on Rails 3 Tutorial on Ubuntu 64 in VMPlayer

I am working through chapter 1 of the Ruby on Rails 3 Tutorial I first ran into trouble when I tried to use Git but that was because I hadn't made the SSH Keys. I have that working but next got stuck on trying to add keys to Heroku. I think it should just be able to save using the same keys. This is what I am getting and I can't figure out what the error is telling me. I am totally new to Ruby and Rails.
bill44077#ubuntu:~/Sites/rails_projects/first_app$ heroku keys:add
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- readline (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/lib/heroku/commands/app.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/lib/heroku/command.rb:5:in `block in <top (required)>'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/lib/heroku/command.rb:5:in `each'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/lib/heroku/command.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/bin/heroku:7:in `<top (required)>'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/bin/heroku:19:in `load'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/bin/heroku:19:in `<main>'
bill44077#ubuntu:~/Sites/rails_projects/first_app$ heroku keys:add
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- readline (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/lib/heroku/commands/app.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/lib/heroku/command.rb:5:in `block in <top (required)>'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/lib/heroku/command.rb:5:in `each'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/lib/heroku/command.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/gems/heroku-1.17.10/bin/heroku:7:in `<top (required)>'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/bin/heroku:19:in `load'
from /home/bill44077/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/bin/heroku:19:in `<main>'
Sorry - I couldn't figure out how to get this to put in line feeds.
Thanks for any help!
Bill44077
It seems your ruby has not been compiled with readline and looking at your ruby path ... you're using RVM.
Look at this documentation :
http://rvm.beginrescueend.com/packages/readline/
basically you'll need to reinstall your ruby with readline (--with-readline-dir).
Don't forget to look at the other rvm options before installing your ruby so you wont have to reinstall it again if you need iconv, zlib or X).
By the way if you don't have readline your rails console should not work and you're in the process of deploying so I'd say ... you should use your rails console more often :-)
Enjoy !

Resources