1

我试图卸载 rvm 以便在我的 Mac 上使用 rbenv。一切正常,直到红宝石发挥作用..

使用时

rbenv install 1.9.3-p194

它可以正确编译,但之后我想安装捆绑器..这会产生以下错误

computer:~ computer$ gem install bundler
/Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 1 column 34 (Psych::SyntaxError)
    from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
    from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:151:in `parse'
    from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:127:in `load'
    from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/config_file.rb:253:in `load_file'
    from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/config_file.rb:191:in `initialize'
    from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
    from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
    from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
    from /Users/computer/.rbenv/versions/1.9.3-p194/bin/gem:21:in `<main>'

然后我尝试安装旧版本的 ruby​​ 1.9.3-p125 .. 但即使构建也无法完成同样依赖于这个心理解释器的类似错误...... :(

computer-2:~ computer$ rbenv install 1.9.3-p125
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/computer/.rbenv/versions/1.9.3-p125
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz...
Installing ruby-1.9.3-p125...
Installed ruby-1.9.3-p125 to /Users/computer/.rbenv/versions/1.9.3-p125
Downloading http://production.cf.rubygems.org/rubygems/rubygems-1.8.23.tgz...
Installing rubygems-1.8.23...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/_9/tcqlf3c14l78vxtr600l9lqr0000gn/T/ruby-build.20120511162948.58105
Results logged to /var/folders/_9/tcqlf3c14l78vxtr600l9lqr0000gn/T/ruby-build.20120511162948.58105.log

Last 10 log lines:
/Users/computer/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/psych.rb:154:in `parse': (<unknown>): couldn't parse YAML at line 0 column 33 (Psych::SyntaxError)
    from /Users/computer/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
    from /Users/computer/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/psych.rb:125:in `parse'
    from /Users/computer/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/psych.rb:112:in `load'
    from /private/var/folders/_9/tcqlf3c14l78vxtr600l9lqr0000gn/T/ruby-build.20120511162948.58105/rubygems-1.8.23/lib/rubygems/config_file.rb:253:in `load_file'
    from /private/var/folders/_9/tcqlf3c14l78vxtr600l9lqr0000gn/T/ruby-build.20120511162948.58105/rubygems-1.8.23/lib/rubygems/config_file.rb:191:in `initialize'
    from /private/var/folders/_9/tcqlf3c14l78vxtr600l9lqr0000gn/T/ruby-build.20120511162948.58105/rubygems-1.8.23/lib/rubygems/gem_runner.rb:78:in `new'
    from /private/var/folders/_9/tcqlf3c14l78vxtr600l9lqr0000gn/T/ruby-build.20120511162948.58105/rubygems-1.8.23/lib/rubygems/gem_runner.rb:78:in `do_configuration'
    from /private/var/folders/_9/tcqlf3c14l78vxtr600l9lqr0000gn/T/ruby-build.20120511162948.58105/rubygems-1.8.23/lib/rubygems/gem_runner.rb:51:in `run'
    from setup.rb:38:in `<main>'
computer-2:~ computer$ 

我在网上找不到有相同问题的东西,所以我问..

我尝试了这两个对我没有帮助的资源,好像 rbenv 安装程序正在自动执行此操作

在 mac osX (Lion) 上为 ruby​​ 安装 libyaml

修复“ruby 安装缺少心理”错误?

有人有建议吗?提前致谢..

4

4 回答 4

9

当我的 .gemrc 或 .irbrc 中出现 YAML 语法错误时,我看到过类似的错误。

检查/删除它们,然后重试。

于 2012-05-11T23:20:56.920 回答
5

我们在.gemrc中遇到了同样的问题。删除.gemrc解决了这个问题。--文件开头有2 个破折号。将它们更改为---(3 个破折号)并将.gemrc留在原处。然后重新安装1.9.3p392没有任何问题。基本上是 YAML 解析器问题。

完整的.gemrc

---
gem: --no-ri --no-rdoc

于 2013-03-12T23:59:21.327 回答
1

更改 gem.rc 文件从

install: --no-rdoc --no-ri
update: --no-rdoc --no-rigem: --no-document

install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
于 2013-08-27T14:22:10.423 回答
0
install: --no-rdoc --no-ri
update: --no-rdoc --no-rigem: --no-document

改成:

install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
gem: --no-document

为了保留更快的 Gem 安装选项

于 2015-04-30T19:32:52.337 回答