jnevelson
jnevelson

Reputation: 2092

Uninitialized constant Psych::Syck on gem install

I pushed a gem up to rubygems.org, and when I do a 'gem install (gem)' I get this error:

ERROR:  While executing gem ... (NameError)
uninitialized constant Psych::Syck

I can do a 'gem build (gem).gemspec' to generate a local gem and then gem install (gem).gem and that installs fine. I can also put the gem into my Rails' app's Gemfile with a pointer to the Github repo and that will also work. I have tried installing the gem (from rubygems.org on multiple computers and they all get the same error.

I am out of ideas as to what can be causing the install to fail when done from rubygems.org but not when I generate it locally. I am using Jeweler to push the gem up to rubygems.org.

Upvotes: 5

Views: 5855

Answers (3)

karthiks
karthiks

Reputation: 7309

The solution would be to run the below command in your terminal:

gem update --system

It is a bug in the system gem version that causes this issue. This worked for me.

Upvotes: 3

B Seven
B Seven

Reputation: 45941

The specific error I got was: uninitialized constant Psych::Syck (NameError) when doing bundle install.

This happened when installing simplecov (awesome code coverage tool) version 0.5.0. Working in Ubuntu 11.04 and using RVM.

Fixed the issue with gem update --system

This updates rubygems and produced the following output:

Updating rubygems-update
Fetching: rubygems-update-1.8.10.gem (100%)
Successfully installed rubygems-update-1.8.10
Installing RubyGems 1.8.10
RubyGems 1.8.10 installed

== 1.8.10 / 2011-08-25

RubyGems 1.8.10 contains a security fix that prevents malicious gems from
executing code when their specification is loaded.  See
https://github.com/rubygems/rubygems/pull/165 for details.

* 5 bug fixes:

* RubyGems escapes strings in ruby-format specs using #dump instead of #to_s
  and %q to prevent code injection.  Issue #165 by Postmodern
* RubyGems attempt to activate the psych gem now to obtain bugfixes from
  psych.
* Gem.dir has been restored to the front of Gem.path.  Fixes remaining
  problem with Issue #115
* Fixed Syck DefaultKey infecting ruby-format specifications.
* `gem uninstall a b` no longer stops if gem "a" is not installed.


------------------------------------------------------------------------------

RubyGems installed the following executables:
    /home/baller/.rvm/rubies/ruby-1.9.2-p180/bin/gem

RubyGems system software updated

Upvotes: 6

Related Questions