Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot load such file -- ruby-wmi (LoadError) & cannot load such file -- win32/service (LoadError)

I did install below mentioned ruby stuff

enter image description here

when i try executing chef-client, i receive below mentioned error

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 folder Structure ( Missing )

enter image description here

like image 263
Mad-D Avatar asked Oct 12 '12 22:10

Mad-D


2 Answers

The error message cannot load such file -- ruby-wmi (LoadError) is coming up because chef-client cannot find the required gems.

This issue is addressed on the Opscode/Chef wiki page on Common Errors.

As mentioned there, install the required gems with the following commands:

C:\> gem install win32-open3 ruby-wmi windows-api windows-pr --no-rdoc --no-ri --verbose
C:\> gem install rdp-ruby-wmi
like image 142
Prakash Murthy Avatar answered Nov 14 '22 12:11

Prakash Murthy


As Prakash Murthy said, It was missing ruby-wmi files. Thought it will help if anyone get stuck again

I did run these commands

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

Got one more error

C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- win32/service (LoadError)

So i would recommend

(i) check gem installed ( in CMD )

gem list

this will pointout missing gems, in my case win32/service was misisng

(ii) gem install win32-service

check gem list again to make sure & should fix the problems.

like image 37
Mad-D Avatar answered Nov 14 '22 11:11

Mad-D