berkshelf / vagrant-berkshelf

A Vagrant plugin to add Berkshelf integration to the Chef provisioners
Other
378 stars 100 forks source link

Claims chef-dk is not installed, even though it is #264

Closed spuder closed 9 years ago

spuder commented 9 years ago

When installing the latest version of vagrant (1.7.2) , and the latest version of chef-dk (4.0.0), vagrant-berkshelf crashes and claims that the chef-dk is not installed.

sowens-MBP:vagrant-windows sowen$ vagrant plugin install vagrant-berkshelf
Installing the 'vagrant-berkshelf' plugin. This can take a few minutes...
Installed the plugin 'vagrant-berkshelf (4.0.2)'!
Post install message from the 'vagrant-berkshelf' plugin:

The Vagrant Berkshelf plugin requires Berkshelf from the Chef Development Kit.
You can download the latest version of the Chef Development Kit from:

    https://downloads.getchef.com/chef-dk

Installing Berkshelf via other methods is not officially supported.
sowens-MBP:vagrant-windows sowen$ vagrant provision
The following berks command failed to execute:

    /Users/sowen/.rvm/gems/ruby-2.2.0/bin/berks --version --format json

The stdout and stderr are shown below:

    stdout:
    stderr: /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'berkshelf' (>= 0) among 56 total gem(s) (Gem::LoadError)
    from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /Users/sowen/.rvm/gems/ruby-2.2.0/bin/berks:22:in `<main>'
    from /Users/sowen/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/sowen/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'

It appears that you are not using the ChefDK. Please note that Vagrant Berkshelf
works best when used with the ChefDK, and other installation methods are not
officially supported.

Please download and install the latest version of the ChefDK from:

    https://downloads.getchef.com/chef-dk

and follow the installation instructions. Do not forget to add the ChefDK to
your PATH.
$ chef --version
Chef Development Kit Version: 0.4.0
spuder commented 9 years ago

Turns out this was an environment issue. While the chefdk was installed, the berks gem was also installed.

I fixed this by moving the following to the front of my path

PATH=/opt/chefdk/bin:$PATH

Now which berks points to the right location.

which berks
/Users/sowen/.rvm/gems/ruby-2.2.0/bin/berks
which berks
/opt/chefdk/bin/berks
vincentmoulene commented 9 years ago

Hello, I spend some time and i found this solution : vagrant plugin install vagrant-berkshelf --plugin-version 2.0.1 --verbose

sethvargo commented 9 years ago

Downgrading to an earlier version of the plugin does not "fix" the issue - you are going to have more problems with older versions of vagrant-berkshelf than just installing the ChefDK and ensuring it is in your $PATH.

vincentmoulene commented 9 years ago

So, I restart the installation and try to follow your instructions. I am blocked by this message :

vagrant plugin install vagrant-berkshelf Installing the 'vagrant-berkshelf' plugin. This can take a few minutes... Installed the plugin 'vagrant-berkshelf (4.0.3)'! Post install message from the 'vagrant-berkshelf' plugin: The Vagrant Berkshelf plugin requires Berkshelf from the Chef Development Kit. You can download the latest version of the Chef Development Kit from: https://downloads.getchef.com/chef-dk Installing Berkshelf via other methods is not officially supported.

and I put this PATH in my .bashprofile : export PATH=/opt/chefdk/bin:$PATH The PATH is good when i do a echo $PATH :

$ echo $PATH /opt/chefdk/bin:/usr/local/php5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin

If you have an idea it's could be very nice. Thank you

spuder commented 9 years ago

what does the output of the following command show?

$ which berks
vincentmoulene commented 9 years ago

Thank you to reply me. This command show :

/opt/chefdk/bin/berks
danielsand commented 9 years ago

just as a follow up:

installation:

vagrant --version
Vagrant 1.7.1

which berks
/opt/chefdk/bin/berks

chef --version
Chef Development Kit Version: 0.6.0
chef-client version: 12.3.0
berks version: 3.2.4
kitchen version: 1.4.0

error on 'vagrant up'

==> ****-*****: Successfully added box 'chef/ubuntu-14.04' (v1.0.0) for 'virtualbox'!
The following berks command failed to execute:

    /opt/chefdk/bin/berks --version --format json

The stdout and stderr are shown below:

    stdout: 
    stderr: /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'berkshelf' (>= 0) among 82 total gem(s) (Gem::LoadError)
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /opt/chefdk/bin/berks:22:in `<main>

on installation of the vagrant-berkshelf plugin i get a warning that chefdk is not in the path - which is not true.

it looks like that /opt/chefdk/bin/berks gets executed out of the vagrant embedded gemrc and vagrant tries then to load the gems from his embedded gems - which obviously is not there.

diegojonio commented 8 years ago

Any solution for this issue?

I'm with the same problem here.

$ vagrant -v Vagrant 1.8.1

$ chef -v Chef Development Kit Version: 0.10.0 chef-client version: 12.5.1 berks version: 4.0.1 kitchen version: 1.4.2

$ echo $PATH /opt/chefdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

$ which berks /opt/chefdk/bin/berks

$ vagrant plugin install vagrant-berkshelf [sudo] password for diegojonio: Installing the 'vagrant-berkshelf' plugin. This can take a few minutes... Installed the plugin 'vagrant-berkshelf (4.1.0)'! Post install message from the 'vagrant-berkshelf' plugin:

The Vagrant Berkshelf plugin requires Berkshelf from the Chef Development Kit. You can download the latest version of the Chef Development Kit from:

https://downloads.chef.io/chef-dk/

Installing Berkshelf via other methods is not officially supported.

dankonino commented 7 years ago

Turns out this was an environment issue. While the chefdk was installed, the berks gem was also installed.

I fixed this by moving the following to the front of my path

PATH=/opt/chefdk/bin:$PATH

Now which berks points to the right location.

which berks

/Users/sowen/.rvm/gems/ruby-2.2.0/bin/berks

which berks /opt/chefdk/bin/berks

thanks really this worked for me, just right now I have to do it everyday because after restarting pc the path is changed to /Users/Matoosh/.rbenv/shims/berks what do you think about doing that automatically?