0

I want to test some changes to a cookbook, so I did what I used to do, but the result was far from normal:

$ ../gem-sucks/bin/kitchen converge
-----> Starting Kitchen (v1.2.1)
!!!!!! The `berkshelf' gem is missing and must be installed or cannot be properly activated. Run `gem install berkshelf` or add the following to your Gemfile if you are using Bundler: `gem 'berkshelf'`.
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::UserError
>>>>>> Message: Could not load or activate Berkshelf (can't activate json-1.8.0, already activated json-1.8.1)
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

$ gem list | grep berkshelf
berkshelf (3.2.1, 3.1.4, 2.0.10, 2.0.9)
berkshelf-api-client (1.2.0)
$ gem list | grep json
json (1.8.1, 1.8.0)
multi_json (1.10.1, 1.7.9)

The machine is running debian Jessie, and lots of packages (I have no idea whether anything ruby related is among) has been updated since I touched this cookbook last.

How do I make kitchen work again?

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
thissucks
  • 3
  • 3

4 Answers4

4

Make sure that the chefdk is in the front of your path.

PATH=/opt/chefdk/bin:/Users/sowen/.rvm/gems/ruby-2.2.0/bin:/Users/sowen/.rvm/gems/ruby-2.2.0@global/bin:/Users/sowen/.rvm/rubies/ruby-2.2.0/bin:/opt/chefdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sowen/go/bin:/Users/sowen/.rvm/bin:/Users/sowen/.rvm/bin:/Users/sowen/go/bin

I ran into this same problem until I adjusted and re-sourced my bash_profile

spuder
  • 17,437
  • 19
  • 87
  • 153
0

If you're using ChefDk, then you might be able to fix the problem by deleting the gems installed at GEM_HOME (in my case /home/username/.chefdk).

If that doesn't work, try using bundle as in bundle exec kitchen converge, this should allow you to use the installed gems in your list.

xaniasd
  • 16
  • 1
  • I tried chefdk once, that gave a horrible mess of issues, so I returned to a standard chef (still from getchef.com, so unfortunately still with an embedded ruby). But I just found out (without having seen your answer) that 'gem uninstall json' and selecting to only removing 1.8.0 helped. – thissucks Dec 12 '14 at 13:35
0

I had a similar issue but json wasn't installed in GEM_HOME and I ended up having to run the following command to resolve my issue.

gem uninstall -i /opt/chefdk/embedded/lib/ruby/gems/2.1.0 json
0

Look this issue https://github.com/test-kitchen/kitchen-vagrant/pull/126

you need re install berkshelf by gem, then apply patch kitchen-vagrant

Install upstream kitchen-vagrant

git clone https://github.com/test-kitchen/kitchen-vagrant.git
cd kitchen-vagrant
gem build kitchen-vagrant.gemspec
gem install kitchen-vagrant-0.15.0.gem

Re install old Berkshelf

gem install berkshelf
Pierozi
  • 352
  • 2
  • 4
  • Berkshelf is now part of the chefdk. installing from gems is discouraged. – spuder Aug 20 '15 at 13:40
  • Yes but Kitchen-Vagrant was worked only with berkshelf by gem. I've not use from long time, I hope the maintainer of plugin have upgrade for deal with ChefDK. – Pierozi Aug 30 '15 at 16:52