无法加载此类文件-Ruby-wmi(loadError)和无法加载该文件-Win32/service(loadError)[英] cannot load such file -- ruby-wmi (LoadError) & cannot load such file -- win32/service (LoadError)

本文是小编为大家收集整理的关于无法加载此类文件-Ruby-wmi(loadError)和无法加载该文件-Win32/service(loadError)的处理方法,想解了无法加载此类文件-Ruby-wmi(loadError)和无法加载该文件-Win32/service(loadError)的问题怎么解决?无法加载此类文件-Ruby-wmi(loadError)和无法加载该文件-Win32/service(loadError)问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我确实在下面安装了提到的红宝石东西

在此处输入图像说明

当我尝试执行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文件夹结构(缺少)

在此处输入图像说明

推荐答案

错误消息cannot load such file -- ruby-wmi (LoadError)是因为chef-client找不到所需的宝石.

此问题在 opscode/opscode/chef wiki wiki page on Comension错误.

如那里所述,将所需的宝石安装在以下命令中:

C:\> gem install win32-open3 ruby-wmi windows-api windows-pr --no-rdoc --no-ri --verbose
C:\> gem install rdp-ruby-wmi

其他推荐答案

作为 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)检查已安装的宝石(在CMD中)

gem list

这将指向缺少宝石,在我的情况下,win32/服务被误导

(ii)gem install win32-service

再次检查宝石列表以确保并应解决问题.

其他推荐答案

厨师的新版本不使用Ruby-WMI,因此您不需要宝石.我在尝试运行测试厨房时遇到了这个错误,我尝试了上面的解决方案,但它们没有起作用.

这对我有用:

  • 卸载并重新安装Vagrant
  • 删除C:\ Users \ username.vagrant.d \ gems文件夹
  • 删除C:\ users \ username.vagrant.d \ plugins.json文件

厨房运行正常.

本文地址:https://www.itbaoku.cn/post/786714.html