用于在具有转发端口80、8080的vagrant中配置vm的vagrant文件抛出错误

用于在具有转发端口80、8080的vagrant中配置vm的vagrant文件抛出错误,vagrant,vagrantfile,Vagrant,Vagrantfile,我的档案里有以下内容 config.vm.forward_port 80, 8080 当我游荡起来时,我得到了这个错误。我的目的是从来宾到主机的端口映射 Bringing machine 'default' up with 'virtualbox' provider... There are errors in the configuration of this machine. Please fix the following errors and try again: vm: * The

我的档案里有以下内容

config.vm.forward_port 80, 8080
当我游荡起来时,我得到了这个错误。我的目的是从来宾到主机的端口映射

Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The following settings shouldn't exist: forward_port

该块中
config
对象的成员变量应该是
forwarded\u port
,符号类型参数为
guest
host
,成员方法为
network
,因此您的行应该如下所示:

config.vm.network 'forwarded_port', guest: 80, host: 8080