我将首次使用 Vagrant。我使用的是 M1 Mac。
我的vagrant up
命令失败并显示以下消息:
vagrant up
Bringing machine 'app' up with 'virtualbox' provider...
Bringing machine 'mysql1' up with 'virtualbox' provider...
Bringing machine 'mysql2' up with 'virtualbox' provider...
Bringing machine 'mysql3' up with 'virtualbox' provider...
Bringing machine 'mysql4' up with 'virtualbox' provider...
Bringing machine 'mysql5' up with 'virtualbox' provider...
==> app: Clearing any previously set forwarded ports...
==> app: Clearing any previously set network interfaces...
==> app: Preparing network interfaces based on configuration...
app: Adapter 1: nat
app: Adapter 2: hostonly
==> app: Forwarding ports...
app: 3000 (guest) => 2000 (host) (adapter 1)
app: 22 (guest) => 2222 (host) (adapter 1)
==> app: Running 'pre-boot' VM customizations...
==> app: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "37d985a0-dc89-4d49-a7f9-02af2ca9b5a4", "--type", "headless"]
Stderr: VBoxManage: error: The VM session was aborted
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component SessionMachine, interface ISession
我在 macOS 上使用它。我还安装了 Virtual Box。
作为故障排除目的的一部分,我尝试重新安装 vagrant hostmanager,但是我还收到以下消息:
vagrant plugin install vagrant-hostmanager
Installing the 'vagrant-hostmanager' plugin. This can take a few minutes...
Vagrant failed to properly resolve required dependencies. These
errors can commonly be caused by misconfigured plugin installations
or transient network issues. The reported error is:
conflicting dependencies logger (= 1.6.0) and logger (= 1.6.1)
Activated logger-1.6.1
which does not match conflicting dependency (= 1.6.0)
Conflicting dependency chains:
logger (= 1.6.1), 1.6.1 activated
versus:
logger (= 1.6.0)
Gems matching logger (= 1.6.0):
logger-1.6.0
您正在尝试在 Apple Silicon Mac:M1 上运行 Vagrant。
因为虽然 Vagrant 在技术上可能可以在 Apple Silicon 上运行,但根本问题是 Virtual Box 目前仅支持 Intel Mac。Vagrant 只是一堆用于自动创建 VM 的脚本;Vagrant 在技术上可以“运行”,但 Virtual Box 本身无法运行。
尝试在 Apple Silicon 上运行 VirtualBox 只会导致失败。