我将一个gem推送到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代码库,这也是可行的。我已经尝试在多台计算机上安装gem (从rubygems.org安装),它们都得到了相同的错误。
当从rubygems.org完成安装时,我不知道是什么原因导致安装失败,而当我在本地生成安装时,我就不知道是什么原因了。我正在用珠宝商把宝石推到rubygems.org上去。
发布于 2011-07-06 13:11:08
看起来是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
以及这里建议的修复方法:
发布于 2011-09-10 23:01:58
我得到的具体错误是:在进行包安装时出现了uninitialized constant Psych::Syck (NameError)。
这发生在安装simplecov (很棒的代码覆盖工具) 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发布于 2011-09-12 15:00:36
解决方案是在您的终端中运行以下命令:
gem update --system导致此问题的是系统gem版本中的错误。这对我很有效。
https://stackoverflow.com/questions/6591594
复制相似问题