cannot load Ruby gems for Chef - ruby

I'm trying to install Chef solo on a VPS. I've installed Ruby and ran the install command for the Chef gems, however, when I check the version of Chef, it says that it can't load the file. I'm following along with the Railscast on the topic http://railscasts.com/episodes/339-chef-solo-basics?view=asciicast, except that I also installed rbenv and Ruby 2.0.0 as a preliminary step.
Can you identify what the cause of this error is?
root#Chef2:~# gem install chef ruby-shadow --no-ri --no-rdoc
Successfully installed chef-11.4.4
Building native extensions. This could take a while...
Successfully installed ruby-shadow-2.2.0
2 gems installed
root#Chef2:~# rbenv rehash
root#Chef2:~# chef-solo -v
/root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- rubygems/format (LoadError)
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/lib/chef/provider/package/rubygems.rb:34:in `<top (required)>'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/lib/chef/providers.rb:60:in `<top (required)>'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/lib/chef.rb:25:in `<top (required)>'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/lib/chef/application/solo.rb:19:in `<top (required)>'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /root/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/chef-11.4.4/bin/chef-solo:23:in `<top (required)>'
from /root/.rbenv/versions/2.0.0-p195/bin/chef-solo:23:in `load'
from /root/.rbenv/versions/2.0.0-p195/bin/chef-solo:23:in `<main>'

Chef 11 is the latest version of chef and is now packaged with an embedded copy of ruby. See the following documentation:
http://wiki.opscode.com/display/chef/Installing+Chef+Client+and+Chef+Solo

What version of rubygem are you using?
Try using rubygems 1.8.25

I think the original poster may have been running into a ruby-2.0/rubygems-2.0 issue like CHEF-3933 on chef 11.4.4 Those have been fixed by now. Chef 11.10.0 supports ruby-2.1 + rubygems-2.2
Gem installs are highly discouraged if there's an omnibus installer. The railscast is now very out of date. Installation should be done with:
curl -L https://www.opscode.com/chef/install.sh | bash -s

Related

Ruby curb gem proplem in Windows 10 x64

My main purpose is execute this ruby code in windows. For this purpose I installed curb gem to Windows 10 by using this method. Although installation is compeleted without any error, I am taking these messages:
C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': 126: The specified module could not be found.
C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/curb-0.9.3/curb_core.so (LoadError)
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/curb-0.9.3/lib/curl.rb:1:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/curb-0.9.3/lib/curb.rb:1:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from ted-postrank.rb:7:in `<main>'
What is going wrong about it?
I recommend using 32bit version of ruby on windows 10 as 64bit has problems with some gems.
First download 32bit ruby installer from http://rubyinstaller.org and install it.
Then
download curl-7.27.0-devel-mingw32, extract it in C:/curl-7.27.0-devel-mingw32
copy both libcurl.dll and libidn-11.dll into the Ruby bin directory.
and install:
gem install curb --platform=ruby -- --with-curl-lib="C:/curl-7.27.0-devel-mingw32/bin" --with-curl-include="C:/curl-7.27.0-devel-mingw32/include"

rhc setup gives error `no such file dl/import`

I'm installing openshift client tools as described: https://developers.openshift.com/en/getting-started-windows.html#client-tools.
On step 'Setting up Your Machine' I got error:
rhc setup
C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
: cannot load such file -- dl/import (LoadError)
Full stack trace:
C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- dl/import (LoadError)
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:1:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/agent/socket.rb:5:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/agent.rb:22:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/key_manager.rb:4:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/session.rb:4:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh.rb:11:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/ssh_helpers.rb:18:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/wizard.rb:77:in `<class:Wizard>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/wizard.rb:7:in `<module:RHC>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/wizard.rb:6:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/commands/base.rb:4:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/commands/account.rb:2:in `<module:Commands>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/commands/account.rb:1:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/commands.rb:189:in `block in load'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/commands.rb:188:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/commands.rb:188:in `load'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/lib/rhc/cli.rb:36:in `start'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.1/bin/rhc:20:in `<top (required)>'
from C:/Ruby22-x64/bin/rhc:23:in `load'
from C:/Ruby22-x64/bin/rhc:23:in `<main>'
I found same problem: https://groups.google.com/forum/#!topic/supmua/hPyTTamhTyc
It's suggest to replace DL with Fiddle.
How I can get working rhc?
Updating net-ssh to 2.9.3.beta1, as cremno suggested in this comment, resolved my problem.
gem install net-ssh -v 2.9.3.beta1
Before that, I tried gem install net-ssh, but it didn't help.
I ran into this problem when I used the latest version of Ruby (currently 2.2.1) as stated on the OpenShift setup instructions. I fixed it by:
Installing Ruby 1.9.3
Re-running "gem install rhc"
After that, I was able to run "rhc setup" without any issue.
If you are running Windows 10 Pro x64, try installing Ruby 2.1.8 (x64) with Git Version 2.7.0. This will surely allow you to run rhc setup as it did happened with me. Earlier I had a problem running & installing latest version of Ruby 2.2.4 (x64) but when I downgraded to ruby version 2.1.8 (x64) I was able to run rhc setup and configure OpenShift client toolson Windows. See the image for Ruby version I'm using - ruby 2.1.8p440 (2015-12-16 revision 53160) [x64-mingw32]
Read here for getting started to OpenShift client tools on windows.
Use the RHC tested Ruby version instead of the latest. As of today it is 1.9.3-p194
Try using/installing a lower version of ruby after uninstalling the 2,2,0 because some windows version conflict with ruby version you are using. I tried 2.2.3 and then lowered to 2.2.0 and it worked for me.
I ran into this same error, and none of the solutions worked for me. In a last attempt, I installed the Ruby 1.9.3-p551 version and the rhc setup went smoothly. I use a Windows 10 machine.
I am running Windows 10 Pro x64. I installed Ruby 2.1.8 (x64) with Git Version 2.7.2. Rhc was installed successfully. However, "rhc snapshot save ..." command had problem with net-ssh. However, after restarting windows 10 the errors was gone.
Remember to try reboot your windows.

Compass installation under rbenv

I thought I had Compass installed OK using rbenv on my Mac, but I got an error when trying to switch Codekit to use it instead of its internal compiler.
Running compass -v in the terminal gives me:
/.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require': cannot load such file -- sass/script/node (LoadError)
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `each'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:5:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:4:in `each'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:4:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:20:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:8:in `fallback_load_path'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:19:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/bin/compass:23:in `load'
from /.rbenv/versions/1.9.3-p392/bin/compass:23:in `<main>'
So, it would seem there's a problem there, although running gem install compass tells me that compass-0.12.2 was successfully installed.
How do I go about working out what the problem is and fixing it?
Try this version,
http://rubygems.org/gems/sass/versions/3.3.0.alpha.149
gem install sass -v 3.3.0.alpha.149 --pre
Bear in mind that the command above installs the gem, it doesn't activate the version!
You can run the following:
gem uninstall sass
You'll be prompted with a list of installed versions; merely uninstall the ones that are 3.3.0.alpha.X where X is higher then 149.
You can test it works via:
sass --version
compass --version
You should see normal pages (instead of the errors in your question).
ps.
You may need this too:
gem install compass-sourcemaps -v 0.12.2.sourcemaps.57a186c --pre
In my case, it was an incompatibility between compass and sass. It was "sass-3.3.0.rc.2" installed automatically via compass dependencies.
So I had to remove sass version gem uninstall sass and install another version gem install sass -v 3.2.12
After that, the errors disappeared.
There's an issue with some imports in one script within compass. An easy fix, but for now you can add this to your Gemfile (works for me right now):
gem "compass", github: 'ovaskevich/compass'

Why does Rails console say "cannot load such file -- readline"?

I am new to Ruby on Rails, and am using RVM to manage Ruby versions.
My laptop has Ruby1.8.7 installed, but my project is using RVM, Ruby1.9.3 and Rails 3.2.11.
I can't run rails c or rails console without it giving me the following error:
/home/phil/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /home/phil/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands/console.rb:3:in `require'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands.rb:38:in `require'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
You need to have the readline libraries installed when you compile Ruby.
If you are on CentOS/Redhat/Fedora Linux, install the package using:
sudo yum install readline-devel
Or, on Ubuntu, use:
sudo apt-get install libreadline6 libreadline6-dev
and then recompile Ruby.

Error while launching knife configure command

I tried to getting started with chef so I installed the chef gem on my laptop ( OS : OSX 10.8) with ruby 2.0.0-p0 but when I try to "knife configure " I juste get this message :
/Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:106:in `require': cannot load such file -- rubygems/format (LoadError)
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:106:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/provider/package/rubygems.rb:34:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/providers.rb:60:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef.rb:25:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chefspec-0.9.0/lib/chefspec.rb:1:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chefspec-0.9.0/lib/chef/knife/cookbook_create_specs.rb:1:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife/core/subcommand_loader.rb:37:in `load'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife/core/subcommand_loader.rb:37:in `block in load_commands'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife/core/subcommand_loader.rb:37:in `each'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife/core/subcommand_loader.rb:37:in `load_commands'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife.rb:119:in `load_commands'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife.rb:167:in `run'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/application/knife.rb:123:in `run'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/bin/knife:25:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/bin/knife:23:in `load'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/bin/knife:23:in `<main>'
The accepted answer isn't entirely correct. The problem isn't ruby 2.0, it's rubygems 2.x. If you run gem update --system 1.8.25 to downgrade to a pre 2.x rubygems, everything works like a champ.
NOTE: I haven't had to do this locally, but this is how I've gotten knife bootstrap to work against my remote servers. I'm running ruby 2.0 on my local machine with latest rubygems and chef 11.4.4 and everything else seems to work properly.
According to this issue at opscode it was a bug. It has been fixed in chef 11.6.0.
The problem is that only chef 11.4.4 is on rubygems as of today (2013-06-23)
So, either use 1.9.x or rubygems 1.8.25 will work for now, until the next version of chef comes out. It may be possible to build it from https://github.com/opscode/chef.git
I ended up patching my chef 11.4.4 lib/chef/provider/package/rubygems.rb with this file: https://github.com/opscode/chef/blob/d6748efde62502ab6f5d97052f46ca00352497ef/lib/chef/provider/package/rubygems.rb
I had similar errors trying to use Chef (10.24 and 11.4) with Ruby 2.0 - so I assume Chef is not yet Ruby 2.0 compatible :(
The accepted answer is great if you're using the system ruby (/usr/bin/ruby, for example), but it didn't work for me because I'm using RVM. I found an equivalent solution in case you're using RVM:
rvm rubygems 1.8.25 will install rubygems version 1.8.25 for your RVM ruby.

Resources