Windows 8.1,最新的 vagrant 和 VirtualBox 版本。在 Windows 上的 git CLI 中运行命令。
我能够ubuntu/trusty64
毫无问题地启动,并且不需要登录 atlas.hashicorp.com。
但是当我尝试时ubuntu/xenial64
出现了错误。
vagrant init ubuntu/xenial64; vagrant up --provider virtualbox
此外,trusty 64 没有引发任何有关使用 登录的警告vagrant login
,但由于 xenial 64 确实引发了这样的警告,我立即在 atlas.hashicorp.com 创建了一个帐户。
我曾经vagrant login
登录过,收到消息“您现在已登录。”
我从文件夹中删除了 vagrant 内容并重做了init
和up
命令,但再次出现同样的错误。
$ vagrant init ubuntu/xenial64; vagrant up --provider virtualbox
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/xenial64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'ubuntu/xenial64' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/ubuntu/xenial64"]
Error:
但“错误:”部分是空白的。
我在其他地方找到了一个建议,将框的 url 添加到如下Vagrantfile
位置:
config.vm.box_url = "http://example.com/some_box_url.box"
https://stackoverflow.com/a/31538713/631764
现在使用评论中建议的链接进行测试。以下是Vagrantfile
除大多数评论外的完整内容:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/xenial64"
config.vm.box_url = "https://atlas.hashicorp.com/ubuntu/boxes/xenial64/versions/20160610.0.0/providers/virtualbox.box"
# VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
# vb.memory = "1024"
end
end
但即使有了 URL,我仍然收到错误:
$ vagrant up --provider virtualbox
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/xenial64' 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 'ubuntu/xenial64' (v0) for provider: virtualbox
default: Downloading: https://atlas.hashicorp.com/ubuntu/boxes/xenial64/versions/20160610.0.0/providers/virtualbox.box
default:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
没有显示任何错误信息。
答案1
我在 OSX 上遇到了同样的问题,不得不删除嵌入的 curl:
sudo rm /opt/vagrant/embedded/bin/curl
然后它将使用系统默认的 curl 而不是嵌入的有缺陷的 curl。
答案2
看来我找到答案了。
最新版本的 Vagrant(似乎 1.8+)包含一个curl
版本不适用于 Windows 7、8、8.1 或 10原样!
但修复起来非常简单。只需安装这个,Microsoft Visual C++ 2010 SP1 可再发行组件包:
https://www.microsoft.com/en-us/download/details.aspx?id=8328
该页面未将 Windows 8.1 列为兼容操作系统,但对我来说它可用。无需重新启动系统,我的虚拟机已启动并运行。
或者,降级到 Vagrant 版本 1.7.4 似乎也可以解决问题: https://releases.hashicorp.com/vagrant/
我在这里找到了这两种解决方案: https://github.com/mitchellh/vagrant/issues/6852
重复的问题: https://github.com/mitchellh/vagrant/issues/6754 https://github.com/mitchellh/vagrant/issues/6861