1

我想在 CentOS 5.8 上使用 ruby​​-1.9.3-p194。我可以用 rvm 和系统安装它(安装了 libyaml 和 libyaml-devel)。但我不能运行所有的“rake”任务(不仅仅是“rake spec”)。

我得到“无法加载这样的文件——yaml/encoding”。这是一个带有跟踪的示例结果。“rake”版本是“0.9.2.2”。我该如何解决?

$ rake spec --trace
rake aborted!
cannot load such file -- yaml/encoding
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `block in require'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
/home/inohiro/Projects/rails_2_3_14_r5066/src/admin/lib/tasks/fixture_dump.rake:2:in `<top (required)>'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:171:in `load'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:171:in `block in load_with_new_constant_marking'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:171:in `load_with_new_constant_marking'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/rails.rb:14:in `block in <top (required)>'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/rails.rb:14:in `each'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/rails.rb:14:in `<top (required)>'
/home/inohiro/Projects/rails_2_3_14_r5066/src/admin/Rakefile:10:in `require'
/home/inohiro/Projects/rails_2_3_14_r5066/src/admin/Rakefile:10:in `<top (required)>'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `load'
/home/inohiro/.rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `<main>'
4

1 回答 1

1

这不是 rake 问题,而是 ruby​​ <=> rails 版本不兼容。您正在使用最新的稳定版 ruby​​ 和恐龙时代的 rails 版本。

你需要做一些黑客攻击才能让他们相互理解!

这是一本不错的读物,应该可以帮助您入门:

http://scottiestech.info/2012/02/07/make-rails-2-3-x-happy-with-ruby-1-9-3/

这个要点也很震撼:

https://gist.github.com/1976864(感谢乔纳森!)

于 2012-05-31T10:12:53.750 回答