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:
但「錯誤:」部分是空白的。
我在其他地方找到了一個建議,將盒子的網址添加到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 Redistributable Package:
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