我在我的环境中使用Vagrant,我遇到了一个小问题:

$vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
    default: Downloading: base

An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /Users/.../base

我已经初始化了我的项目与流浪者初始化,但出于某种原因流浪者拒绝工作。


当前回答

看起来你可能已经创建了一个Vagrant项目,只是Vagrant init。这将创建您的Vagrantfile,但它不会定义一个框。

相反,你可以试试

$ vagrant init hashicorp/precise32 $ vagrant up

它使用标准的Ubuntu映像。Vagrant网站上有一个Getting Started,上面给出了一些很好的例子。

其他回答

在开始一个Vagrant之前,第一步也是最重要的一步是,检查系统中所有的框。 使用此命令获取可用的方框列表。

流浪箱名单

然后进入进一步的过程,即选择一个特定的框

初始化ubuntu/trusty64(我已经选择ubuntu/trusty64)

然后,

流浪汉了

谢谢

我知道这是旧的,但我得到了完全相同的错误。结果发现我遗漏了文档中清楚显示的这一步。

我需要编辑Vagrantfile,将config.vm.box设置为我下载的映像hashicorp/precise32。默认情况下,它被设置为base。

以下是文档的内容:

现在箱子已经添加到Vagrant,我们需要配置我们的 项目使用它作为基础。打开Vagrantfile并更改 内容如下: Vagrant.configure("2") do |config| Config.vm.box = "hashicorp/precise32" 结束

请在你的终端上运行:

$ vagrant box list

您将看到类似laravel/homestead(virtualbox,x.x.x)的内容。

接下来找到你的Vagrantfile,找到上面写着的那行

config.vm.box = "box"

运行流浪箱列表时,将箱替换为箱名。

当你做vagrant init时,它会替换你的repo中的vagrant文件,并给你这个错误。所以我建议你从远程复制原始的vagrant文件或备份的vagrant文件,然后试试vagrant。

我遇到了同样的问题,我只是从我的远程回购复制了流浪者文件,并替换了我试图运行的流浪者文件。这将使流浪文件中的配置与虚拟机同步。

创建虚拟框时遵循以下语法:

 $ vagrant box add {title} {url}
 $ vagrant init {title}
 $ vagrant up

参见http://www.vagrantbox.es/