尝试流浪汉时出错

use*_*022 217 vagrant

我正在为我的环境使用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
Run Code Online (Sandbox Code Playgroud)

我初始化了我的项目vagrant init但由于某种原因vagrant up拒绝工作.

Bri*_*anC 254

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

相反,你可以试试

$ vagrant init hashicorp/precise32
$ vagrant up

它使用标准的Ubuntu映像.Vagrant网站有一个入门,提供了一些很好的例子.

  • Gar,就是这样.为什么会这样说"你现在准备好'流浪'你的第一个虚拟环境!" 然后?? (16认同)
  • 如果你已经分别完成了'vagrant init`和`vagrant box add`,你可以编辑Vagrantfile并将config.vm.box设置为"hashicorp/precise32"或你想要使用的任何框. (5认同)

小智 101

如果你正在使用OS X并使用标准安装,删除vagrant的旧卷曲,它现在应该可以工作

sudo rm /opt/vagrant/embedded/bin/curl

  • 为什么它嵌入*curl*? (8认同)
  • 这解决了我在使用本地和远程盒子时在mac上的问题 (7认同)
  • 谢谢!这是OS X的_correct_事物. (6认同)
  • 谢谢,这也解决了我.+1投票:) (5认同)
  • `-rf`标志在这里有点矫枉过正.只需`sudo rm/opt/vagrant/embedded/bin/curl`即可.你应该尽量避免使用`-r`(=递归下行目录)和`-f`(=强制没有任何问题).它们是一种强大而危险的工具,特别是与sudo结合使用时...... (3认同)
  • 非常感谢.它解决了我的问题. (2认同)

Bar*_*ime 83

vagrant init laravel/homestead
Run Code Online (Sandbox Code Playgroud)

然后

vagrant up
Run Code Online (Sandbox Code Playgroud)

什么对我有用.

  • 完美!谢谢 !如果有人能解释我为什么会这样,我会很高兴:) (4认同)
  • 您需要指定有效的框类型。以下是一些有效的框类型:https://atlas.hashicorp.com/boxes/search?utf8=%E2%9C%93&sort&provider=virtualbox&q=debian (2认同)
  • 如果已经有 vagrantfile,则将 --force 与 vagrant init 一起使用 (2认同)

小智 43

这是因为有一个没有定义框名称的vagrant文​​件.当你使用box name参数运行vagrant init时会发生这种情况 .

所以你必须删除Vagrant文​​件

vagrant init box-title
vagrant up
Run Code Online (Sandbox Code Playgroud)

你可以在这里找到所有的盒子

我希望这可以帮助你!


小智 21

对我来说,这些是以下步骤:

  • cd homestead (在您的目录homestead文件夹中)或 cd Homestead
  • del vagrantfile 要么 rm -Rf Vagrantfile
  • vagrant init laravel/homestead
  • vagrant up


小智 15

请在您的终端中运行:

$ vagrant box list
Run Code Online (Sandbox Code Playgroud)

你会看到类似的东西 laravel/homestead(virtualbox,x.x.x)

接下来找到你的Vagrantfile并找到所说的那一行

config.vm.box = "box"
Run Code Online (Sandbox Code Playgroud)

box在运行时替换为框名称vagrant box list.


小智 15

我知道这是旧的,但我得到了完全相同的错误.事实证明我错过了文档中明确的这一步骤.

我需要编辑它Vagrantfile以设置config.vm.box等于我下载的图像,hashicorp/precise32.默认情况下,它设置为base.

这是文档说的内容:

现在该框已添加到Vagrant,我们需要配置我们的项目以将其用作基础.打开Vagrantfile并将内容更改为以下内容:

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise32"
end
Run Code Online (Sandbox Code Playgroud)


小智 12

如果"Vagrantfile" already exists in this directory. Remove it before running "vagrant init". 错误显示

1. rm Vagrantfile
2. vagrant init hashicorp/precise64
3. vagrant up
Run Code Online (Sandbox Code Playgroud)


nic*_*asf 9

在Vagrant中嵌入式卷曲程序似乎有问题.按照上面的建议,我只是将其重命名(以防万一我想要它)并vagrant up开始按预期工作.

在我的Mac上:

? .vagrant.d sudo mv /opt/vagrant/embedded/bin/curl /opt/vagrant/embedded/bin/curlOLD Password:


小智 6

我也遇到过这个错误.我想是因为我没有提供box_url ..

vagrant init precise64 http://files.vagrantup.com/precise64.box
Run Code Online (Sandbox Code Playgroud)


lee*_*lee 5

对我来说,运行时出现错误vagrant up(我使用的是 Macbook pro,Mac OS:10.12.1):

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...

我试图删除Vagrantfile我的文件夹中的并运行:

vagrant init hashicorp/precise64

然后:

vagrant up

它可以解决我的问题。希望这可以帮助面临同样问题的人。


Man*_*kar 5

当我运行以下命令时,我遇到了同样的问题

vagrant init
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: Box file was not detected as metadata. Adding it directly...
==> 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 /home/...../base
Run Code Online (Sandbox Code Playgroud)

我纠正了

>vagrant init laravel/homestead
>Vagrant up
Run Code Online (Sandbox Code Playgroud)

它对我有用。

快乐编码


SMs*_*ant 5

在启动 Vagrant 之前,第一步也是最重要的一步是,检查系统中存在哪些所有框。使用此命令获取可用框列表。

vagrant box list

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

vagrant init ubuntu/trusty64 (我选择了 ubuntu/trusty64)

然后,

vagrant up

谢谢