Unable to open the rails console - ruby-on-rails

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

Related

rhc setup on Windows shows 'require' errors

I am trying to setup rhc tools on a newly installed Windows 8.1 Pro x64. I already have git, ruby and successfully installed the rhc gem.
The tutorial I used - https://developers.openshift.com/en/getting-started-windows.html#client-tools
I've used rhc tools on Ubuntu and never on Windows, and I have no idea what the error means.
Doing rhc setup shows the following error:
>rb --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]
>git --version
git version 1.9.5.msysgit.1
>rhc setup
C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' : cannot load such file -- dl/import (LoadError)
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54 :in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:1:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/agent/socket.rb:5:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/agent.rb:22:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/key_manager.rb:4:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/session.rb:4:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh.rb:11:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/ssh_helpers.rb:18:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/wizard.rb:77:in `<class:Wizard>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/wizard.rb:7:in `<module:RHC>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/wizard.rb:6:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands/base.rb:4:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands/account.rb:2:in `<module:Commands>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands/account.rb:1:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands.rb:189:in `block in load'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands.rb:188:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands.rb:188:in `load'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/cli.rb:36:in `start'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/bin/rhc:20:in `<top (required)>'
from C:/Ruby22-x64/bin/rhc:23:in `load'
from C:/Ruby22-x64/bin/rhc:23:in `<main>'
Edit:
The following post solves the problem - rhc setup gives error `no such file dl/import`
It seems that there is also a bug reported for this - https://bugzilla.redhat.com/show_bug.cgi?id=1201844
For windows:
gem install net-ssh -v 2.9.3.beta1
I have a lot of experience running Ruby on Windows, but finally I (and others) came up to conclusion that it's not possible to run some gems without errors on Windows at the moment.
You can run and install one gem, but you'll get an error in another gem. Finally I tired fixing them.
But good news is that you can use Vagrant + VirtualBox + Rails on Windows. You may want to read my blog post about that.
I was getting this problem too. you are using "Ruby 2.2.0". Please use 1.9.3 version instead. It'll work like a charm

Cannot Start Up Rails 4 Server

Getting this when I attempt to run "rails s"
/Users/JustinLonas/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/JustinLonas/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/x86_64-darwin13.0.0/digest/sha1.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (LoadError)
Referenced from: /Users/JustinLonas/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/x86_64-darwin13.0.0/digest/sha1.bundle
Reason: image not found - /Users/JustinLonas/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/x86_64-darwin13.0.0/digest/sha1.bundle
from /Users/JustinLonas/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/JustinLonas/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.5.2/lib/bundler/definition.rb:1:in `<top (required)>'
from /Users/JustinLonas/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.5.2/lib/bundler.rb:152:in `definition'
from /Users/JustinLonas/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.5.2/lib/bundler.rb:115:in `setup'
from /Users/JustinLonas/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.5.2/lib/bundler/setup.rb:7:in `<top (required)>'
from /Users/JustinLonas/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require'
from /Users/JustinLonas/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /Users/JustinLonas/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
from /Users/JustinLonas/projects/gohobbyist/config/boot.rb:4:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
I actually fixed this issue. I reinstalled homebrew and downloaded the yosemite CLI tools and everything just worked after that.

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.

Rails Installation problems (Mac 10.7)

I just installed ruby using homebrew and performed a gem install of rails.
While it says that rails has been installed, when i type in rails on terminal i get the following output :
/Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': dlopen(/Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/x86_64-darwin11.4.0/digest/md5.bundle, 9): Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib (LoadError)
Referenced from: /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/x86_64-darwin11.4.0/digest/md5.bundle
Reason: image not found - /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/x86_64-darwin11.4.0/digest/md5.bundle
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.13/lib/rails/generators/app_base.rb:1:in `<top (required)>'
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.13/lib/rails/generators/rails/app/app_generator.rb:1:in `<top (required)>'
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.13/lib/rails/commands/application.rb:24:in `<top (required)>'
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.13/lib/rails/cli.rb:15:in `<top (required)>'
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.13/bin/rails:7:in `<top (required)>'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/bin/rails:19:in `load'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/bin/rails:19:in `<main>'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/moveablecode/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
Any solution to fix these errors?
try to use railsinstaller. download it from http://railsinstaller.org/
and follow steps from http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac it will more helpful for you.This is easiest way to install rails

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