gpt4 book ai didi

使用 Hyper-V 的 Windows 10 上的 Vagrant 错误

转载 作者:行者123 更新时间:2023-12-02 17:11:23 26 4
gpt4 key购买 nike

升级到 Windows 10 后运行:

$ vagrant up

我们收到以下错误消息

An error occurred while executing a PowerShell script. This error
is shown below. Please read the error message and see if this is
a configuration error with your system. If it is not, then please
report a bug.

Script: get_vm_status.ps1
Error:

C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\providers\hyperv\scripts\get_vm_status.ps1 : Unable to
find type [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException].
At line:1 char:1
+ &('C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\prov ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Hyper...FailedException:TypeName) [get_vm_status.ps1], Ru
ntimeException
+ FullyQualifiedErrorId : TypeNotFound,get_vm_status.ps1

使用 Vagrant 1.7.4。

有什么想法吗?

最佳答案

我在 Windows 10 Enteprise 上全新安装 Vagrant 1.7.4 时遇到了同样的问题(第一次使用 Vagrant)。

在最新版本的 PowerShell 中,VirtualizationOperationFailedException 类型似乎已替换为 VirtualizationException

我将 C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\providers\hyperv\scripts\get_vm_status.ps1 的第 15 行更改为:

} catch [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException] {

} catch [Microsoft.HyperV.PowerShell.VirtualizationException] {

现在我可以使用 vagrant up 和 vagrant status 而不会出现错误。这显然不是一个长期的解决方案,但却让事情再次运转起来。可能还有其他脚本也被破坏了,但我还没有遇到过它们。

关于使用 Hyper-V 的 Windows 10 上的 Vagrant 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31790077/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com