Manish Das
Manish Das

Reputation: 3893

uninitialized constant Psych::Syck (NameError)

In my gem i require yaml and works great on my computer locally.

But after pushing my gem into rubygems.org and when i try to use my gem i get an error saying => "uninitialized constant Psych::Syck (NameError)"

Can anyone help me to fix this problem?

P.S.

Ruby Version => ruby 1.9.2,
Gem Version => 1.6.2,
Bundler version => 1.0.15

Upvotes: 5

Views: 4724

Answers (1)

Manish Das
Manish Das

Reputation: 3893

After several hours of research I found that => "YAML uses the unmaintained Syck library, whereas Psych uses the modern LibYAML"

So in order to resolve that error, I had to update my gem (gem update --system i.e. 1.8.6) and rescue the LoadError thrown by Psych before requiring yaml, something like this:

begin
 require 'psych'
 rescue ::LoadError
end

require 'yaml'

Source:

Upvotes: 8

Related Questions