Vagrant 设置 IP 语法错误

Vagrant 设置 IP 语法错误

当我尝试在 vagrant box 上设置静态 IP 时,似乎出现了错误。在我的 vagrant 文件中,我有以下内容:

Vagrant.configure(2) do |config|

config.vm.box = "box-cutter/centos67"
config.vm.network "private_network", ip: "192.168.50.5”

end

运行 Vagrant UP 时我似乎收到一个错误:

以下 Vagrantfile 中存在语法错误。为方便起见,语法错误消息如下所示:

/Vagrantfile:4: unterminated string meets end of file
/Vagrantfile:4: syntax error, unexpected end-of-input, expecting keyword_end

如果我删除该config.vm.network "private_network", ip: "192.168.50.5”线路,盒子将正常启动。

我是否遗漏了什么?我从 Vagrant 网站复制了此内容

感谢您的帮助


将引号改为相同的之后,我现在收到此错误:

/Vagrantfile:4: no .<digit> floating literal anymore; put 0 before dot
config.vm.network “private_network”, ip: “192.168.50.5”

Vagrantfile:4: syntax error, unexpected tFLOAT, expecting '('
config.vm.network “private_network”, ip: “192.168.50.5”

答案1

感谢 Michael Hampton - 引用了正确的引文

Vagrant.configure(2)执行|配置|

config.vm.box = "box-cutter/centos67"
config.vm.network "private_network", ip: "192.168.50.5"

end

Mac 上的 TextEdit代替

相关内容