我确实安装了下面提到的红宝石
当我尝试执行chef-client时,我收到下面提到的错误
c:\RubyDevKit>chef-client
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- ruby-wmi (LoadError)
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/chef-10.14.4/lib/chef/provider/env/windows.rb:20:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/chef-10.14.4/lib/chef/providers.rb:49:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/chef-10.14.4/lib/chef.rb:25:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/chef-10.14.4/bin/chef-client:23:in `<top (required)>'
from C:/Ruby193/bin/chef-client:23:in `load'
from C:/Ruby193/bin/chef-client:23:in `<main>'
Ruby193文件夹结构(缺失)
答案 0 :(得分:9)
错误消息cannot load such file -- ruby-wmi (LoadError)
即将发布,因为chef-client
无法找到所需的宝石。
Opscode/Chef wiki page on Common Errors解决了这个问题。
如前所述,使用以下命令安装所需的gem:
C:\> gem install win32-open3 ruby-wmi windows-api windows-pr --no-rdoc --no-ri --verbose
C:\> gem install rdp-ruby-wmi
答案 1 :(得分:6)
正如 Prakash Murthy 所说,它缺少ruby-wmi文件。如果有人再次陷入困境,我认为这会有所帮助
我确实运行了这些命令
C:\> gem install win32-open3 ruby-wmi windows-api windows-pr --no-rdoc --no-ri --verbose
C:\> gem install rdp-ruby-wmi
还有一个错误
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- win32/service (LoadError)
所以我建议
(i)检查安装的gem(在CMD中)
gem list
这将指出丢失的宝石,在我的情况下win32 / service is misisng
(ii)gem install win32-service
再次检查宝石清单以确保&amp;应该解决问题。
答案 2 :(得分:0)
较新版本的Chef不使用ruby-wmi,因此您不需要gem。我在尝试运行测试厨房时遇到了这个错误,我尝试了上面的解决方案但是他们没有工作。
这对我有用:
那之后厨房运行良好。