No such file to load -- yaml (LoadError)

Hello

I am trying to migrate my ruby from old server to new server.

I did a copy of all the binaries and have set all the relevant patch.
However I am not sure what I am missing. Below require works completely
fine on my old server. however , does not work fine in new server.

How can I know where is the yaml file located on the old server and any
advise how to fix this issue.

File Content:
require ‘yaml’
puts “Test”

test.rb:1:in `require’: no such file to load – yaml (LoadError)

what is the ruby version of the new server? you may miss some gem
installed

gem install yaml

Hans M. wrote in post #1101208:

what is the ruby version of the new server? you may miss some gem
installed

gem install yaml

Thanks for your reply

ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]

gem -v
1.0.1

I copied entire binary from old machine to new one, so assume all is
good.

I tried to do gem install yaml

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require': no such file to load -- zlib (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:10
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/format.rb:9
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:11
… 11 levels…
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:103:in
process_args' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:74:inrun’
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:39:in `run’
from /usr/local/bin/gem:22
xmargind@nygeqdbxmgdev01:/export/applications/datasynapse/ruby/internalapps/shared_infra/compiled/bin>

On 03/13/2013 10:56 AM, Mitesh S. wrote:

ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]

gem -v
1.0.1

I copied entire binary from old machine to new one, so assume all is
good.

This is not a good idea. In Linux, rarely is the entire program in one
binary. It is also linked to shared libraries on the system, like zlib.

Besides, as you can see you are using a version of Ruby from 2007 and an
equally ancient version of rubygems.

Unless the new machine is also running software from 2007, I recommend
reinstalling Ruby properly via RVM, compiling from source, or using your
system’s package manager.

-Justin

Am 13.03.2013 18:56, schrieb Mitesh S.:

Hans M. wrote in post #1101208:

what is the ruby version of the new server? you may miss some gem
installed

gem install yaml

YAML is not a gem but part of the standard library.

Thanks for your reply

ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]

Unless you have a very good reason to use 1.8.6
you definitely should upgrade (at least to 1.9.3).

gem -v
1.0.1

I copied entire binary from old machine to new one, so assume all is
good.

You copied only the binary?
Then I assume your complete standard library is missing.

Try

ruby -e ‘p $LOAD_PATH’

In one of these directories there should be a ton of .rb files,
you need those, too (and all the subdirectories).

BUT: I highly recommend to install a current version from scratch.