我在做一个流浪汉时遇到以下错误:
$ vagrant up
D:/Jumbo/vagrants/endeca_vagrants/Vagrantfile:27:in `block in <top (required)>': undefined method `[]' for nil:NilClass (NoMethodError)
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/config/v2/loader.rb:37:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/config/v2/loader.rb:37:in `load'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/config/loader.rb:107:in `each'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/config/loader.rb:107:in `block in load'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/config/loader.rb:104:in `each'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/config/loader.rb:104:in `load'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/vagrantfile.rb:28:in `initialize'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:746:in `new'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:746:in `vagrantfile'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:492:in `host'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:214:in `block in action_runner'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/action/runner.rb:33:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/action/runner.rb:33:in `run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:479:in `hook'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:728:in `unload'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/bin/vagrant:141:in `ensure in <main>'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.5/bin/vagrant:141:in `<main>'
我的Vagrant文件的内容如下:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Copyright 2012, Javelin Group
require 'yaml'
current_dir = File.dirname(File.expand_path(__FILE__))
configs = YAML.load_file("#{current_dir}/config.yaml")
vagrant_config = configs['configs'][ENV['USER']]
Vagrant.configure("2") do |config|
config.vm.box = "D:/Jumbo/JumboDoc/endecavagrant/endeca.box"
# Boot with a GUI so you can see the screen. (Default is headless)
config.vm.provider "virtualbox" do |v|
v.gui = false
v.customize ["modifyvm", :id, "--memory", 4096]
v.name = "Jumbo Endeca VM"
end
config.vm.network :forwarded_port, guest: 8006, host: 8006, auto_correct: true
config.vm.network :forwarded_port, guest: 8888, host: 8888, auto_correct: true
config.vm.network(:private_network, ip: "192.168.50.3", virtualbox__intnet: "intnet")
# maps workstation kattle ETL folder to the vm folder
config.vm.synced_folder "#{vagrant_config['etl_dir']}", "/usr/local/endeca-deployment/development/etl"
config.vm.network(:private_network, ip: "192.168.50.3", virtualbox__intnet: "intnet")
# maps workstation endeca custom app config folder to the vm folder
config.vm.synced_folder "#{vagrant_config['app_config']}", "/usr/local/endeca-deployment/development/custom-script"
config.vm.synced_folder "#{vagrant_config['pipelines']}", "/usr/local/endeca-deployment/development/config/pipelines"
config.vm.synced_folder "#{vagrant_config['templates']}", "/usr/local/endeca-deployment/development/cartridge_templates"
config.vm.synced_folder "#{vagrant_config['report_templates']}", "/usr/local/endeca-deployment/development/report_templates"
end
我已经尝试更新oracle vm虚拟盒的版本。而且vagrant 1.9.4在其他系统上使用相同的文件。我也尝试在C:驱动器中清空我的空间。但没有得到解决方案。我怎样才能解决这个问题 ?请帮忙。
答案 0 :(得分:0)
错误是它没有从环境中找到用户。这就是为什么vagrant_configs为零。感谢@axiac。