How Do You Troubleshoot the Vagrant Message “/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require’: cannot load such file — winrm (LoadError)”?

Problem scenario
You are running Vagrant, but you get this error: "/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- winrm (LoadError)"

You run "gem list" (or "sudo gem list") and see winrm is installed.

What should you do?

Possible Solution #1 (recommended)

  1. Run this command:
gem list | grep libvirt

2. Verify that libvirt's version is at least 0.6 or higher. If it is, go to step #3. If it is lower than that, use the following two commands:

# gem uninstall fog-libvirt
# gem install fog-libvirt

3. Run these two commands:

vagrant plugin install winrm
vagrant plugin install winrm-elevated

4. Now try the vagrant command again.

Possible Solution #2 (not recommended)
Install the Ruby development package. For a CentOS/RHEL/Fedora server, use this: sudo yum -y install ruby-devel

Run both of these commands (despite the one with "sudo" not being recommended):

gem install winrm
# the command below is not recommened
sudo gem install winrm

Now try the original command again.

Possible Solution #3 (not recommended)
Run the "vagrant" command with "sudo".

Leave a comment

Your email address will not be published. Required fields are marked *