4

我收到以下错误:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- psych (LoadError)
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/yaml.rb:5:in `<top (required)>'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /usr/local/bin/hub:190:in `<main>'

我已经尝试过 Stack Overflow 上与 libyaml 和 psych 相关的建议。但是,其中许多需要返回以下错误的 rvm 命令:

rvm reinstall 2.0
/Users/richardburton/.rvm/src/ruby-2.0.0-p247 has already been removed.
Removing /Users/richardburton/.rvm/rubies/ruby-2.0.0-p247 - please wait
Error running '__rvm_rm_rf /Users/richardburton/.rvm/rubies/ruby-2.0.0-p247',
please read /Users/richardburton/.rvm/log/1401921952_ruby-2.0.0-p247/remove.rubies.log
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-2.0.0-p247.

显然在这个阶段有一个 rvm 二进制文件可用。任何有关如何启动和运行 Ruby 2.0 的提示或建议将不胜感激。

谢谢!

4

3 回答 3

0

您收到的第一个错误是引用您的系统 ruby​​,并且您正在使用 rvm 重新安装。尝试运行which ruby。这很可能可以通过更新您的路径来解决。我不建议重新安装系统 ruby​​,所以我绝对建议使用 rvm 获取导致第一个错误的任何内容。

如果这仍然不起作用,我接下来会尝试使用 rbenv 而不是 rvm。我个人是 rbenv 的粉丝,并且我的 Ruby 使用它没有任何问题。启动和运行非常容易,并且可能是一个很好的临时修复。

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile # or whichever profile you are using
$ source ~/.bash_profile                           # or whichever profile you are using
$ rbenv install <version number>
$ rbenv global <version number>

rbenv 信息的链接:

rbenv:https ://github.com/sstephenson/rbenv

红宝石构建:https ://github.com/sstephenson/ruby-build#readme

于 2014-06-05T06:41:14.247 回答
0
rvm package install libyaml
rvm reinstall 1.9.3 --with-libyaml-dir=/home/rails/.rvm/usr

我有同样的错误,这对我有用

来源:https ://serverfault.com/questions/442150/how-to-fix-ruby-installation-is-missing-psych-for-yaml-output-on-centos

于 2014-12-20T00:35:09.457 回答
-1

我遇到了同样的问题,我尝试了两种解决方案:

1) 使用 ruby​​-build 构建带有前缀 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr 的 ruby​​-2.0-p451 --> DOES NOT WORK (GOT SEGMENTATION FAULT)

2) 用 OSX 10.9 附带的库存版本替换 ---> WORKS!!

请在此处查看我的代码片段:https ://gist.github.com/joneslee85/73ece54ba5b3a17e8bb2

现在我可以去睡觉了。祝你好运!

于 2014-06-05T14:43:48.723 回答