0

我正在尝试在 VPS 上安装 Chef solo。我已经安装了 Ruby 并运行了 Chef gem 的安装命令,但是,当我检查 Chef 的版本时,它说它无法加载文件。我正在关注关于http://railscasts.com/episodes/339-chef-solo-basics?view=asciicast主题的 Railscast ,除了我还安装了 rbenv 和 Ruby 2.0.0 作为初步步骤。

你能确定这个错误的原因是什么吗?

  root@Chef2:~# gem install chef ruby-shadow --no-ri --no-rdoc
    Successfully installed chef-11.4.4
    Building native extensions.  This could take a while...
    Successfully installed ruby-shadow-2.2.0
    2 gems installed
    root@Chef2:~# rbenv rehash
    root@Chef2:~# chef-solo -v
    /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- rubygems/format (LoadError)
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/lib/chef/provider/package/rubygems.rb:34:in `<top (required)>'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/lib/chef/providers.rb:60:in `<top (required)>'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/lib/chef.rb:25:in `<top (required)>'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/lib/chef/application/solo.rb:19:in `<top (required)>'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/bin/chef-solo:23:in `<top (required)>'
        from /root/.rbenv/versions/2.0.0-p195/bin/chef-solo:23:in `load'
        from /root/.rbenv/versions/2.0.0-p195/bin/chef-solo:23:in `<main>'
4

3 回答 3

0

你用的是什么版本的rubygem?

尝试使用 ruby​​gems 1.8.25

于 2014-02-17T14:36:35.617 回答
0

我认为原始海报可能已经遇到了 ruby​​-2.0/rubygems-2.0 问题,例如 Chef 11.4.4 上的 CHEF-3933 这些问题现在已经修复。Chef 11.10.0 支持 ruby​​-2.1 + ruby​​gems-2.2

如果有综合安装程序,则非常不鼓励 Gem 安装。railscast 现在已经过时了。安装应通过以下方式完成:

curl -L https://www.opscode.com/chef/install.sh | bash -s

于 2014-02-17T20:06:09.293 回答
0

Chef 11 是 Chef 的最新版本,现在包含一个嵌入的 ruby​​ 副本。请参阅以下文档:

http://wiki.opscode.com/display/chef/Installing+Chef+Client+and+Chef+Solo

于 2013-07-19T17:54:47.133 回答