3
$ 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
aSilveira
  • 79
  • 2
  • 10

2 Answers2

2

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
thomaswsdyer
  • 346
  • 1
  • 10
  • I'n sorry, Im a real noob, could you elaborate a little more on how add something to a `$PATH?` I'm sorry, I really want to learn this what could I read to become more familiar with these things? Do I just run that command? – aSilveira Jan 18 '15 at 07:56
  • 1
    Yes, to add additional directories to your PATH, use the `export PATH=` command above. To permanently add to your PATH, check out [this post](http://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux). For more information on the PATH variable, have a read through [this](http://www.linfo.org/path_env_var.html). – thomaswsdyer Jan 18 '15 at 16:14
  • Using the `export PATH=` command worked, I just had to replace the `/opt/chefdk/bin` part with the location **chefdk** was stored in my system. – aSilveira Jan 19 '15 at 02:26
0

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.