macos 修复“ruby 安装缺少 psych”错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9880855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fixing the "ruby installation is missing psych" error?
提问by Zack Shapiro
I'm running Ruby ruby 1.9.3p125 and I keep getting this error which is making it impossible for me to do any kind of development in Rails.
我正在运行 Ruby ruby 1.9.3p125 并且我不断收到此错误,这使我无法在 Rails 中进行任何类型的开发。
It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.
看来您的 ruby 安装缺少 psych(对于 YAML 输出)。要消除此警告,请安装 libyaml 并重新安装 ruby。
I've Googled around and tried seemingly everything but nothing seems to be working. I'm really eager to start on some new projects but can't seem to get around this hurdle.
我已经谷歌搜索并尝试了看似所有的东西,但似乎没有任何效果。我真的很想开始一些新项目,但似乎无法绕过这个障碍。
Any help is greatly appreciated!
任何帮助是极大的赞赏!
采纳答案by Jesper Grann Laursen
I had same problem after installing ruby 1.9.3 with rvm. I solve it by downloading yaml-0.1.4.tar.gzinto ~/.rvm/archives and then reinstalled ruby again.
使用 rvm 安装 ruby 1.9.3 后,我遇到了同样的问题。我通过将yaml-0.1.4.tar.gz下载到 ~/.rvm/archives 中,然后再次重新安装 ruby 来解决它。
cd ~/.rvm/archives
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
rvm reinstall 1.9.3
If you get some compileerrors, try with this instead
如果你得到一些编译错误,试试这个
rvm reinstall 1.9.3 --with-gcc=clang
回答by Rajender Saini
for ubuntu 64 bit nothing was working, but finally when I installed
对于 ubuntu 64 位没有任何工作,但最后当我安装
libyaml-dev using
libyaml-dev 使用
sudo apt-get install libyaml-dev
sudo apt-get install libyaml-dev
everything worked even with reinstalling ruby
即使重新安装 ruby 也一切正常
回答by ur5us
The error message is a little confusing.
错误信息有点令人困惑。
For Ubuntu Linux
try installing
对于Ubuntu Linux
尝试安装
sudo apt-get install libyaml-dev
Or for openSuSE Linux
run
或者为了openSuSE Linux
跑步
sudo zypper install libyaml-devel
then re-compile & re-install Ruby and you should be good to go.
然后重新编译并重新安装 Ruby,你应该很高兴。
A couple of points, though -- run make clean
to remove old compiled files. Then run sudo make install
to ensure you have proper permissions for system level installs. Finally, you might get some "file 'lib' not found" errors... ignore these. Rails seems to work just fine.
但是,有几点 - 运行make clean
以删除旧的编译文件。然后运行sudo make install
以确保您对系统级安装具有适当的权限。最后,您可能会收到一些“找不到文件‘lib’”错误……忽略这些错误。Rails 似乎工作得很好。
回答by matt
You need libyaml to be present at the time that Ruby 1.9.3 is built. See my answer here, describing the process (without rvm):
您需要在构建 Ruby 1.9.3 时存在 libyaml。在这里看到我的回答,描述了这个过程(没有 rvm):
回答by Day Davis Waterbury
Simple solution to this for me was brew install libyaml
. In my case I got the message:
对我来说,简单的解决方案是brew install libyaml
. 就我而言,我收到了以下消息:
Warning: libyaml-0.1.6_1 already installed, it's just not linked
警告:libyaml-0.1.6_1 已经安装,只是没有链接
So, brew link libyaml
produced
于是,brew link libyaml
产生
Linking /usr/local/Cellar/libyaml/0.1.6_1... 5 symlinks created
链接 /usr/local/Cellar/libyaml/0.1.6_1 ... 创建了 5 个符号链接
Done. This assumes you have homebrew, which you should. If you don't, install it thusly:
完毕。这假设您有自制软件,您应该这样做。如果不这样做,请按如下方式安装:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
...and then start at the top here. Cheers!
...然后从这里的顶部开始。干杯!