Gem in metadata.rb and a load error on the first chef client run

Ohai Chefs,

I am using gem setting e.g. gem 'rubyzip'… in the metadata.rb to install some gems prerequisite for the cookbook’s custom resource. The gems do get installed before the coookbooks are compiled, however first chef runs fails at the require in the custom resource with a failure to load a file at the compilation phase. E.g. LoadError: cannot load such file -- zip. Second chef client run succeeds.

What am I missing? My understanding is that with the gem metadata instruction, gem install happens at compile time and is available for usage at converge time and the former seems to be the case judging by the log output.

This is on Windows and with chef-client 12.10

Thank you

What version of Chef 12.10? What’s the patch version or third version number?

It looks like you need at least 12.10.48 to get chef#4929 which adds a call to Gem.clear_paths. The stable 12.10 release was 12.10.24, which is probably what you’re running. So you likely need to upgrade to 12.11+.

Yep I am running 12.10.24 - will upgrade. Thank you Bryan.