Chef kitchen ruby gems error fails to converge on windows

694 views Asked by At

chef verify shows error that gems dependencies on this path error C:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems/dependency.rb:310:in `to_specs': Could not find 'test-kitchen' (= 1.15.0) - did find: [test-kitchen-1.17.0] (Gem::MissingSpecVersionError)

GEM_PATH=C:/Users/ravikiran/AppData/Local/chefdk/gem/ruby/2.3.0;C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0', execute `gem env` for more information
        from C:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems/dependency.rb:320:in `to_spec'
        from C:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
        from C:/opscode/chefdk/bin/kitchen:19:in `<main>'
2

There are 2 answers

5
OK999 On

how about installing the test-kitchen (= 1.15.0) gem, that it says is missing. See this on how to install a ruby gem. http://guides.rubygems.org/rubygems-basics/

update on how to install gem using the chefdk's ruby: I don't have a chefdk installed in a windows OS, but you should see the ruby installed by the chefdk here PATH_TO_chefdk/embedded/bin/ruby.

So, i just installed a chefdk on my win10 x64 (as its a friday :) )... And then to use the ruby from chefdk. follow this https://docs.chef.io/install_dk.html .. Refer to the "Powershell" section. But in short, just run chef shell-init powershell | Invoke-Expression in the PS console.

now you should be able to install the gem version. enter image description here

2
coderanger On

Remove your ~/.chefdk folder, you probably tried to upgrade some gems in-place at some point. Wiping that out should get you back to baseline (if it doesn't, reinstall the ChefDK package too).