2

Because of a bug with Float#round in Ruby 1.8.6, I was forced to upgrade to 1.9.3 and boy was that awful. After install, irb didn't work, complaining of a lack of psych. So I tried to install the gem, but it was angry that libyaml didn't exist, so I installed that. Not sure why they weren't included if they were so important.

Now when I use require 'Location.rb' (after having to specify that I actually do want to look in the current folder... using $LOAD_PATH), I get this error:

 LoadError: cannot load such file -- crack/xml
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/ap-0.1.1/lib/ap.rb:2:in `<top (required)>'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/tyre77/Dropbox/Aurora/GMap.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):3
from /usr/local/bin/irb:12:in `<main>'

What does this mean? Also, when I execute ruby -v, it lists my version as 1.9.3p0 but this is dicking around in 1.9.1? All I want is my irb back and working!

lulalala
  • 17,572
  • 15
  • 110
  • 169
Chris
  • 11,819
  • 19
  • 91
  • 145
  • What OS? Why aren't you using RVM? – Mark Thomas Feb 20 '12 at 00:34
  • Who forced you to upgrade? You could have used 1.8.7 or wrritten your own Float.round. – David Grayson Feb 20 '12 at 00:35
  • @MarkThomas OS X. I am using RVM, and when I `rvm install 1.9.3` it says I already have. I tried reinstalling it, which was successful. `ruby -v` says I'm on 1.9.3, but irb is looking in `.../ruby/1.9.1` and I don't know why – Chris Feb 20 '12 at 00:37
  • @DavidGrayson I could have, yes, but I wasn't expecting a stable release to fail so spectacularly. Having a simple class (round) in a basic class (Float) didn't inspire much confidence to stick around – Chris Feb 20 '12 at 00:38

2 Answers2

6

It turned out that Ruby was looking for an XML parser called 'crack'. I don't know why it is referencing 2 versions of Ruby or why these dependencies aren't included in the Ruby build (since irb won't work without them) but to fix I installed the crack gem. sudo gem install crack

lulalala
  • 17,572
  • 15
  • 110
  • 169
Chris
  • 11,819
  • 19
  • 91
  • 145
1

you can use

require_relative 'Location.rb'

or

require './Location.rb'
dursun
  • 1,861
  • 2
  • 21
  • 38
  • in a file yes, but not in irb. That also won't fix the LoadError about crack – Chris Feb 20 '12 at 00:35
  • or you can use it as require 'XXXlib/Location.rb' I dont know which library you are using. take look at here http://stackoverflow.com/questions/4632090/how-can-i-reload-a-script-in-irb – dursun Feb 20 '12 at 00:44
  • not a library, just testing scripts that are all in a folder together – Chris Feb 20 '12 at 00:47
  • what about "require './Location.rb'" – dursun Feb 20 '12 at 07:45
  • Yeah that works, as does require_relative, but it is still such a pain to have to add ./ to the load path. – Chris Feb 20 '12 at 14:40