使用gem时终端'解析错误'

时间:2014-09-28 19:11:33

标签: ruby-on-rails ruby terminal gem

每当我输入gem命令时,我都会收到以下错误:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 3 column 1 (Psych::SyntaxError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:129:in `load'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/config_file.rb:319:in `load_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/config_file.rb:192:in `initialize'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `new'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `do_configuration'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:46:in `run'
from /usr/bin/gem:21:in `<main>'

我检查了其他线程,这似乎是一个解析问题,但在我的情况下,我无法确定解析错误发生的位置。我甚至无法输入&#39; gem -v&#39;没有得到错误。我是终端的新手,所以在提供解决方案时请记住这一点。谢谢!!

1 个答案:

答案 0 :(得分:0)

正在发生的是作为YAML解析器的Psych遇到语法错误。可能是您的主文件夹(.gemrc

中有一个错误的cd ~文件