Uninitialized constant Psych :: Syck on gem install

I pressed gem to rubygems.org, and when I do "gem install (gem)", I get this error:

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

I can create a "gem build (gem) .gemspec" to create a local gem, and then gem install (gem) .gem, and this installs fine. I can also put the gem in the Gemfile of the Rails application with a pointer to the Github repository, which will also work. I tried installing a gem (from rubygems.org on several computers, and they all get the same error.

I don’t understand what might cause the installation to fail while rubygems.org is running, but not when I create it locally. I use Jeweler to push gem to rubygems.org.

+5
source share
3 answers

The specific error I received was: uninitialized constant Psych::Syck (NameError)when installing the package.

This happened when installing simplecov (amazing code coverage tool) version 0.5.0. Work on Ubuntu 11.04 and use RVM.

Fixed issue with gem update --system

This updates rubygems and produces 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
+6
source

The solution is to execute the following command in your terminal:

gem update --system

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

+3
source

All Articles