我把一个宝石推到了rubygems.org,当我做一个'gem install(gem)'时我得到了这个错误:
ERROR: While executing gem ... (NameError)
uninitialized constant Psych::Syck
我可以做一个'gem build(gem).gemspec'来生成一个本地gem然后gem install(gem).gem并且安装得很好。我也可以将gem放入我的Rails'应用程序的Gemfile中,并指向Github repo,这也可以。我已经尝试安装gem(从多台计算机上的rubygems.org获取相同的错误。
我不知道从rubygems.org完成安装失败的原因是什么,但是当我在本地生成它时却没有。我正在使用珠宝商将宝石推到rubygems.org。
答案 0 :(得分:6)
我在进行捆绑安装时遇到的具体错误是:uninitialized constant Psych::Syck (NameError)
。
安装simplecov(awesome code coverage tool)版本0.5.0时发生了这种情况。在Ubuntu 11.04中工作并使用RVM。
修复了gem update --system
这会更新rubygems并产生以下输出:
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
答案 1 :(得分:3)
似乎是Syck的一个问题。见这里:
Rails 3.1 on Ubuntu 11.04 via RVM - uninitialized constant Psych::Syck
下面:
http://rubyforge.org/tracker/?group_id=126&atid=575&func=detail&aid=29163
答案 2 :(得分:3)
解决方案是在终端中运行以下命令:
gem update --system
系统gem版本中的一个错误会导致此问题。这对我有用。