Vagrant启动问题:sh: netsh: 命令未找到。

3

我正在使用macOS Mojave。在安装了VirtualBox和Vagrant之后,我尝试运行"vagrant up"命令。然而,我遇到了以下奇怪的错误:

Dir: VA $vagrant up
sh: netsh: command not found
sh: cscript: command not found
It seems that you don't have the privileges to change 
the firewall rules. NFS will not work without that 
firewall changes. Execute the following commands via 
cmd as administrator:
netsh advfirewall firewall add rule 
name="VagrantWinNFSd-1.4.0" dir="in" action=allow 
protocol=any 
program="\Users\Ten\.vagrant.d\gems\2.4.4\gems\vagrant 
...

似乎 netshcscript 命令属于 Windows。然而,我正在使用 macOS,并且我确定我的 VirtualBox 和 Vagrant 是为 macOS 设计的。
有人能帮我解决这个问题吗?谢谢!
===================== 更新 ===================
最终我解决了这个问题。但是很抱歉我忘记了我在这里提出了问题,更糟糕的是我忘记了如何解决它。
我唯一记得的是,首先安装 VirtualBox,然后再安装 Vagrant 是重要的。重新安装可能会有所帮助。
希望这能有所帮助。

这里也遇到了同样的问题,但不确定是否是问题所在。我的 vagrant up 命令最终失败于 in nfs_export': wrong number of arguments (given 4, expected 5)`。即使我禁用了 nfs。 - Timo002
你在安装Vagrant之前是否安装了VirtualBox?如果你先安装了Vagrant再安装VirtualBox,就会出现这样的问题。 - Kevin
我没想起来了。但你说得对,这很有可能是原因。谢谢!@Kevin - Fileland
1个回答

4
我在 macOS Sierra (10.12.6) 上遇到了这个问题。后来发现我安装了插件 vagrant-winnfsd,卸载它之后问题得以解决。
要卸载该插件,请运行以下命令:
vagrant plugin uninstall vagrant-winnfsd

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接