Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find 'berkshelf' (>= 0) among 90 total gem(s) (Gem::LoadError)

I am having issues when setting up Chef and Vagrant for my rails app. When I try:

$ vagrant up

I get the error:

Bringing machine 'default' up with 'virtualbox' provider...
The following berks command failed to execute:

    /Users/user/.chefdk/gem/ruby/2.1.0/bin/berks --version --format json

The stdout and stderr are shown below:

stdout: 
stderr: /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:313:in `to_specs':                        
    Could not find 'berkshelf' (>= 0) among 90 total gem(s) (Gem::LoadError)
    Checked in 'GEM_PATH=/Users/user/.vagrant.d/gems:/Applications/Vagrant/bin/../embedded/gems', execute `gem env` for more information
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:322:in `to_spec'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:58:in`gem'
    from /Users/user/.chefdk/gem/ruby/2.1.0/bin/berks:22:in `<main>'

Then when I run gem env, I get:

RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-darwin14.0]
- INSTALLATION DIRECTORY: /Users/user/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /Users/user/.rbenv/versions/2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/user/.rbenv/versions/2.1.0/bin
- SPEC CACHE DIRECTORY: /Users/user/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
  - /Users/user/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
  - /Users/user/.gem/ruby/2.1.0
- GEM CONFIGURATION:
  - :update_sources => true
  - :verbose => true
  - :backtrace => false
  - :bulk_threshold => 1000
  - "gem" => "--no-document"
- REMOTE SOURCES:
  - https://rubygems.org/
- SHELL PATH:
  - /Users/user/.rbenv/versions/2.1.0/bin
  - /usr/local/Cellar/rbenv/0.4.0/libexec
  - /Users/user/.chefdk/gem/ruby/2.1.0/bin
  - /opt/chefdk/bin
  - /Users/user/.rbenv/shims
  - /Users/user/.chefdk/gem/ruby/2.1.0/bin
  - /opt/chefdk/bin
  - /opt/chef/embedded/bin
  - /usr/local/bin
  - /Library/Frameworks/Python.framework/Versions/3.4/bin
  - /Users/user/.rbenv/shims
  - /Users/user/.chefdk/gem/ruby/2.1.0/bin
  - /opt/chefdk/bin
  - /opt/chef/embedded/bin
  - /usr/local/bin
  - /Library/Frameworks/Python.framework/Versions/3.4/bin
  - /Users/user/.chefdk/gem/ruby/2.1.0/bin
  - /opt/chefdk/bin
  - /Users/user/.rbenv/shims
  - /opt/chef/embedded/bin
  - /usr/local/bin
  - /Library/Frameworks/Python.framework/Versions/3.4/bin
  - /Users/user/.rbenv/shims
  - /Users/user/.rbenv/bin
  - .git/safe/../../bin
  - /Users/user/.rbenv/shims
  - /Users/user/.bin
  - /usr/local/sbin
  - /usr/local/bin
  - /usr/bin
  - /bin
  - /usr/sbin
  - /sbin
  - /opt/X11/bin
  - /Users/user/Documents/AppFiles/gsutil
  - /Applications/Postgres.app/Contents/Versions/9.3/bin
  - /Users/user/.rvm/bin
  - /usr/sbin
  - /Users/user/.rvm/bin
  - /Users/user/Documents/AppFiles/gsutil
  - /Applications/Postgres.app/Contents/Versions/9.3/bin
  - /Users/user/.rvm/bin
  - /usr/sbin
  - /Users/user/.rvm/bin
  - /Users/user/Documents/AppFiles/gsutil
  - /Applications/Postgres.app/Contents/Versions/9.3/bin
  - /Users/user/.rvm/bin
  - /usr/sbin
  - /Users/user/.rvm/bin

Berkshelf is installed, as well as, ChefDK. I also made sure to add:

PATH=$HOME/.chefdk/gem/ruby/2.1.0/bin:/opt/chefdk/bin:$PATH to my .bash_profile.

Any help would be much appreciated!

like image 387
Bryan Saxon Avatar asked Dec 12 '22 01:12

Bryan Saxon


2 Answers

vagrant-berkshelf support only Berkshelf installed by Chef-DK.

You need to remove Chef & Berkshelf install by gem.

gem uninstall chef chef-zero berkshelf knife-solo

And install Chef-DK from chef website https://downloads.getchef.com/chef-dk, new version contain all of these tools


EDIT

If you use Kitchen, you need keep Berkshelf install by gem follow this post for know how do that : https://stackoverflow.com/a/28221417/3271231

like image 64
Pierozi Avatar answered Apr 29 '23 21:04

Pierozi


Also check C:\opscode\chefdk\bin is before the embedded\bin in your PATH. You can check with chef -v

chef -v
WARN: C:/opscode/chefdk/embedded/bin is before C:/opscode/chefdk/bin in your Path, please reverse that order.
WARN: consider using the correct `chef shell-init <shell>` command to setup your environment correctly.
Chef Development Kit Version: 0.4.0
like image 27
KCD Avatar answered Apr 29 '23 23:04

KCD