Kitchen/berkshelf wants old gem?

半世苍凉 提交于 2020-01-06 14:14:31

问题


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?


回答1:


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.




回答2:


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




回答3:


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



回答4:


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


来源:https://stackoverflow.com/questions/27424987/kitchen-berkshelf-wants-old-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!