当我的laravel项目流浪时,我收到以下错误:
$ vagrant up
/project/path/vendor/laravel/homestead/scripts/homestead.rb:4:in `configure': undefined method `[]' for false:FalseClass (NoMethodError)
from /project/path/Vagrantfile:20:in `block in <top (required)>'
from /usr/lib/ruby/vendor_ruby/vagrant/config/v2/loader.rb:37:in `call'
from /usr/lib/ruby/vendor_ruby/vagrant/config/v2/loader.rb:37:in `load'
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:103:in `block (2 levels) in load'
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:97:in `each'
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:97:in `block in load'
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:94:in `each'
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:94:in `load'
from /usr/lib/ruby/vendor_ruby/vagrant/vagrantfile.rb:28:in `initialize'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:580:in `new'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:580:in `vagrantfile'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:365:in `host'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:169:in `block in action_runner'
from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:33:in `call'
from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:33:in `run'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:352:in `hook'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:562:in `unload'
from /usr/bin/vagrant:176:in `ensure in <main>'
from /usr/bin/vagrant:176:in `<main>'
错误发生在homestead.rb第4行:
ENV['VAGRANT_DEFAULT_PROVIDER'] = settings["provider"] ||= "virtualbox"
任何想法?
流浪文件:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
homesteadYamlPath = "Homestead.yaml"
homesteadJsonPath = "Homestead.json"
afterScriptPath = "after.sh"
aliasesPath = "aliases"
require File.expand_path(confDir + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
答案 0 :(得分:2)
我的Homestead.yaml文件为空。 我创建了它,一切都按预期工作。
答案 1 :(得分:1)
我认为你忘了这些命令:
// Mac / Linux...
bash init.sh
// Windows...
init.bat
此命令将Homestead.yaml,after.sh和alies文件复制到laravel目录。