Vagrant Berkshelf could not find the 'berks' executable in your PATH. When running 'vagrant up'

3.5k Views Asked by At
$ vagrant up
Bringing machine 'district' up with 'virtualbox' provider...
Vagrant Berkshelf could not find the 'berks' executable in your PATH.

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.
  • I downloaded the latest version of ChefDK as instructed.
  • How would I add the path to Berkshelf in the vagrant file?

Here is the my current Vgrantfile:

$ cat Vagrantfile
# vi: set ft=ruby :

    Vagrant.configure('2') do |config|
      config.vm.define 'district' do |app|
        app.vm.box = 'ubuntu/trusty64'

        app.vm.provider 'virtualbox' do |v|
          v.memory = 1024
          v.name = 'district'
        end

        app.ssh.forward_agent = true
        app.vm.network :forwarded_port, guest: 4567, host: 4567

        app.vm.synced_folder './', '/home/vagrant/WhatsMyDistrict'

        app.berkshelf.enabled = true

        app.vm.provision :chef_solo do |chef|
          chef.log_level = :debug
          chef.custom_config_path = 'chef_solo.config'
          chef.run_list = ['whatsmydistrict::default']
        end
      end
    end
2

There are 2 best solutions below

3
On BEST ANSWER

Make sure you've added /opt/chefdk/bin to your $PATH.

It's recommended to have it prior to any ruby path locations - prepending is the easiest way to ensure this.

export PATH=/opt/chefdk/bin:$PATH
0
On

For Windows users ChefDK is installed in C:\opscode\chefdk\bin as explained here.

So you have to write this command line instead : export PATH=/c/opscode/chefdk/bin:$PATH.

You can also follow these steps adding the path C:\opscode\chefdk\bin. You may have to restart your computer to apply the changes.