$ vagrant box update
==> default: Checking for updates to 'ubuntu/jammy64'
default: Latest installed version: 20231027.0.0
default: Version constraints: 20241002.0.0
default: Provider: virtualbox
default: Architecture: "amd64"
The metadata for the box was malformed. The exact error
is shown below. Please contact the maintainer of the box so
that this issue can be fixed.
unexpected token at '<!DOCTYPE html><html lang="en-us"><head>
<meta charset="utf-8">
<title>HashiCorp Cloud Platform</title>
...
这似乎是由于 的变化造成的metadata_url
。
工作示例:
https://vagrantcloud.com/api/v2/vagrant/ubuntu/jammy64
非工作示例:
https://vagrantcloud.com/ubuntu/jammy64
URL 何时更改的?
我想到两种解决方法:
- 一行代码(例如使用
sed
)即可修复这些 URL。 - 在另一个目录中安装相同盒子类型的全新盒子
vagrant init
将导致~/.vagrant.d/boxes/
更新。