ruby-on-rails – Ruby On Rails libyaml

我在
Linux上运行rails版本3.2.8和ruby版本1.9.3-p286

user1@company.com [~/rails_apps/myapp]# rails -v
Rails 3.2.8
user1@company.com [~/rails_apps/myapp]# ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
user1@company.com [~/rails_apps/myapp]#

我可以生成迁移,但我无法运行它.我一直收到以下错误消息

user1@company.com [~/rails_apps/myapp]# rake db:migrate
/home3/user1/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/yaml.rb:56: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.
/home3/user1/ruby/gems/gems/json-1.7.5/lib/json/common.rb:67: [BUG] unknown type 0x22 (0xc given)
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
<snip>

那么很多调试信息
    

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Aborted
user1@company.com [~/rails_apps/myapp]#

我安装了libyaml

rvm pkg install libyaml

然后重新安装ruby

rvm reinstall ruby-1.9.3-p286

但这没有帮助.

为什么我一直收到此错误消息的任何其他想法?

谢谢.

最佳答案 您需要在系统上安装libtool软件包,否则libyaml将无法编译.对于Ubuntu尝试:

sudo apt-get install libtool
rvm pkg安装libyaml
rvm pkg install libyaml-dev
rvm重新安装1.9.3

您也可以使用您的发行版软件包管理器来安装库而不是rvm.对于Ubuntu:

sudo apt-get install libyaml libyaml-dev

点赞