warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead - Chef Development Kit Update

Today, I needed to do some tests with a newer version of the Chef Client and test my cookbooks. To version 14.12.9-1 to be precise. I also upgraded my ChefDK on my workstation to the 4.2.0 version. I believe that upgrades Ruby version as well and now I have ruby version 2.6.3p62

Right after the upgrade, I tried with a basic knife node list command to see if I needed to reboot or anything was broke...

Everything seems to be working fine, except I get this annoying "warning" message. As it's just a warning, I don't really care about it as it just seems to annonce something that is deprecated...

Problem;
You receive "warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead" warning when using ruby or chef knife commands.

Solution;
You need to comment out that warning message in Ruby lib scripts.
In my case, because my Ruby environment is installed with ChefDK, the path to the issue was here ;

C:\opscode\chefdk\embedded\lib\ruby\2.6.0\Win32API.rb

After a couple of searches online, I saw people pointing out to other files such as;

dl.rb like this guy (https://medium.com/rijdz-blog/dl-is-deprecated-please-use-fiddle-1e4236704490)

or like these here https://stackoverflow.com/questions/15590450/ruby-2-0-0p0-irb-warning-dl-is-deprecated-please-use-fiddle?rq=1

If you're not sure, you can load the whole ruby setup folder in VSCode and do a deep search and find the string "Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead" and comment that line out of the whatever.rb file it is.




Comments

Popular posts from this blog

System.Messaging.MessageQueueException (0x80004005): A workgroup installation computer does not support the operation (Public Queue create issue)

Veeam Backup Error : Failed to prepare guest for hot backup. Error: VSSControl