【问题标题】:Run command vagrant up and get default: warning: connection timeout. Retrying运行命令 vagrant up 并获取默认值:警告:连接超时。重试
【发布时间】:2016-03-24 04:58:51
【问题描述】:

我查看了其他一些关于此的帖子,他们说的一半内容为 0,因为对我或他们说在终端中运行的命令返回为找不到命令。我有一个 Windows 操作系统,所以这可能是问题所在。如果您在使用 Windows 时遇到此问题,请提供帮助!

我已经禁用了防火墙,但什么也没做。

流浪文件:

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION = "2"
confDir = $confDir ||= File.expand_path("~/.homestead")

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/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

【问题讨论】:

  • 我在 Windows 主机上使用 vagrant。你能粘贴你的 VagrantFile 吗?
  • 是在宅基地文件夹内吗,如果是,我会把它放在帖子上
  • 什么windows版本?什么Wm软件?你的流浪文件是什么样子的?启用调试并发布错误
  • Windows 10,不知道你说的wm软件是什么意思,我把文件贴在帖子上让你现在可以看到。
  • 哦,这是宅基地。 VMWare 还是 VirtualBox?请在 vagrant 中启用调试并发布它

标签: php laravel cmd vagrant homestead


【解决方案1】:

好的,因为问题与 VT-x/AMD-V 硬件加速有关,您应该有 2 个选项:

  1. 如果您的硬件支持,请从您的 bios 启用虚拟化(可能在您的设置中关闭)

  2. 如果您的硬件/CPU 不支持它,请告诉 vagrant 通过在您的 Vagrantfile 中添加它来关闭硬件虚拟化

    config.vm.provider :virtualbox do |vb| 
      vb.customize ["modifyvm", :id, "--hwvirtex", "off"]
    end
    

类似

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION = "2"
confDir = $confDir ||= File.expand_path("~/.homestead")

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/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

    config.vm.provider :virtualbox do |vb| 
      vb.customize ["modifyvm", :id, "--hwvirtex", "off"]
    end
end

【讨论】:

  • 我应该把它放在 vagrantfile 的什么地方?尽管感谢您的反馈,但我认为这不起作用。在这一点上,我将继续不使用 vb/homestead。
  • 在您的 vagrantfile 中添加示例,您是否还检查了您的 bios 设置?
猜你喜欢
  • 2014-08-26
  • 1970-01-01
  • 1970-01-01
  • 2017-10-08
  • 2015-03-28
  • 1970-01-01
  • 2020-11-12
  • 2018-10-24
  • 2016-02-04
相关资源
最近更新 更多