使用 berkshelf 执行 "vagrant provision" 时出错
Error when doing "vagrant provision" with berkshelf
我正在使用 Windows 安装了 vagrant 和 chefdk。我可以毫无问题地成功 vagrant up
虚拟机。所以我接下来要做的是向它添加配置功能。我下载了一些食谱并创建了一个 Berksfile
来解决依赖关系,但是当我 运行 vagrant provision
时,它显示以下错误:
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': No such file or directory - K: (Errno::ENOENT)
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:203:in `each'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
from C:/Users/victorwong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.3/lib/vagrant-berkshelf/action/load.rb:40:in `mkshelf'
from C:/Users/victorwong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.3/lib/vagrant-berkshelf/action/load.rb:23:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/env_set.rb:19:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/Users/victorwong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.3/lib/vagrant-berkshelf/action/check.rb:18:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/call.rb:53:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:214:in `action_raw'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:191:in `block in action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:516:in `lock'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
它告诉我它不能在 K:
上 mkdir
,因为它不存在。这是我现在断开连接的外部驱动器的驱动器。我不知道为什么 K:
会出现在这里。当我不启用 berkshelf
时不会出现此错误,因此它可能与 berkshelf
.
有关
我的 Berksfile:
source "https://supermarket.getchef.com"
cookbook 'java', path: 'chef-script/cookbooks/java'
我的流浪文件:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# ...
config.omnibus.chef_version = :latest
config.berkshelf.enabled=true
config.vm.provision "chef_solo" do |chef|
chef.cookbooks_path = "chef-script/cookbooks"
chef.add_recipe "java"
end
end
那么,2 个问题:
Q1。我怎样才能强制它 C:
而不是 K:
;
Q2。为什么它默认指向 K:
?
终于找到原因了,希望有人觉得有用。其实很简单。 K:
来自环境变量 HOMEDRIVE
.
在 Windows
的 CMD 中输入命令
SET
运行时环境变量列表出来了。如果有这样的东西
HOMEDRIVE=K:
或任何奇怪的驱动器号,然后宾果游戏!现在要更改值,只需
SET HOMEDRIVE=C:
然后事情就像一个魅力。
我仍然不知道是谁以及何时设置了这个运行时变量。但无论如何它解决了我的问题。
我正在使用 Windows 安装了 vagrant 和 chefdk。我可以毫无问题地成功 vagrant up
虚拟机。所以我接下来要做的是向它添加配置功能。我下载了一些食谱并创建了一个 Berksfile
来解决依赖关系,但是当我 运行 vagrant provision
时,它显示以下错误:
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': No such file or directory - K: (Errno::ENOENT)
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:203:in `each'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
from C:/Users/victorwong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.3/lib/vagrant-berkshelf/action/load.rb:40:in `mkshelf'
from C:/Users/victorwong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.3/lib/vagrant-berkshelf/action/load.rb:23:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/env_set.rb:19:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/Users/victorwong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.3/lib/vagrant-berkshelf/action/check.rb:18:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/call.rb:53:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:214:in `action_raw'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:191:in `block in action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:516:in `lock'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
它告诉我它不能在 K:
上 mkdir
,因为它不存在。这是我现在断开连接的外部驱动器的驱动器。我不知道为什么 K:
会出现在这里。当我不启用 berkshelf
时不会出现此错误,因此它可能与 berkshelf
.
我的 Berksfile:
source "https://supermarket.getchef.com"
cookbook 'java', path: 'chef-script/cookbooks/java'
我的流浪文件:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# ...
config.omnibus.chef_version = :latest
config.berkshelf.enabled=true
config.vm.provision "chef_solo" do |chef|
chef.cookbooks_path = "chef-script/cookbooks"
chef.add_recipe "java"
end
end
那么,2 个问题:
Q1。我怎样才能强制它 C:
而不是 K:
;
Q2。为什么它默认指向 K:
?
终于找到原因了,希望有人觉得有用。其实很简单。 K:
来自环境变量 HOMEDRIVE
.
在 Windows
的 CMD 中输入命令SET
运行时环境变量列表出来了。如果有这样的东西
HOMEDRIVE=K:
或任何奇怪的驱动器号,然后宾果游戏!现在要更改值,只需
SET HOMEDRIVE=C:
然后事情就像一个魅力。
我仍然不知道是谁以及何时设置了这个运行时变量。但无论如何它解决了我的问题。