1

我正在开发我的第一个 Rails 应用程序。我刚刚从 Rails 3.2.13 更新到 Rails 4,现在我试图安装 ruby​​ 2.0.0,但我整天都遇到同样的错误。我在 SO 和其他地方发现了几个问题,其中许多问题的答案已被接受,但根本没有一个解决方案对我有用。

最后,我最终完全删除了所有 ruby​​ 版本并完全删除了 rvm,但即使尝试从头开始重新安装它也会导致相同的错误。我在 OSX 10.8.4 上。

错误

Extracting rubygems-2.0.6 ...
Removing old Rubygems files...
Installing rubygems-2.0.6 for ruby-2.0.0-p247......................
Error running 'env GEM_PATH=/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247:/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247@global:/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247:/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247@global GEM_HOME=/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247 /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -d /Users/arielpontes/.rvm/src/rubygems-2.0.6/setup.rb',
please read /Users/arielpontes/.rvm/log/ruby-2.0.0-p247/1375132582_rubygems.install.log
Installation of rubygems did not complete successfully.
Saving wrappers to '/Users/arielpontes/.rvm/wrappers/ruby-2.0.0-p247'...

日志

[2013-07-29 18:23:54] /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
Exception `LoadError' at /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:1082 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:1091 - cannot load such file -- rubygems/defaults/ruby
/Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require': dlopen(/Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
  Referenced from: /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle
  Reason: image not found - /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:1:in `<top (required)>'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/yaml.rb:5:in `<top (required)>'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems.rb:600:in `load_yaml'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/config_file.rb:313:in `load_file'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/config_file.rb:190:in `initialize'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:66:in `new'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:66:in `do_configuration'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:46:in `run'
    from setup.rb:45:in `<main>'

有人知道我能做些什么来解决它吗?我已经尝试了这个问题的解决方案,但无济于事。谢谢。

4

1 回答 1

6

好吧,我终于设法解决了!对不起,如果我最终污染了 SO。无论如何,我都会回答我的问题,以防有人遇到类似的问题并在未来结束。

根据 Homebrew 的说法,事实证明我的安装很混乱libyaml,“已安装但未链接”。在尝试了这个解决方案后我想通了。所以我卸载libyaml并杀死它sudo rm -rf并再次安装它。我遇到了这个问题,但接受的答案解决了它。在此之后,我使用稳定的 ruby​​ 从头开始​​安装 RVM,它终于成功了!

于 2013-07-30T01:08:36.380 回答