Windows 上的 Vagrant 错误消息缺少行号

Vagrant error message missing line numbers on Windows

我的 Vagrantfile 某处有错误:

C:\Users\myuser\repos\centos-ansible-box>vagrant up
Installing plugins: vagrant-proxyconf
There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.

Path: C:/Users/myuser/repos/centos-ansible-box/Vagrantfile
Line number: /Users/myuser/repos/centos-ansible-box/Vagrantfile
Message: TypeError: no implicit conversion from nil to integer

我的行号有什么问题?如果没有它,真的很难猜出问题所在。

我想这不会发生在所有用户身上,因为我找不到错误报告,也没有发现其他人抱怨,所以我很困惑。

Vagrantfile 示例:

# -*- mode: ruby -*-
# vi: set ft=ruby :

foo

并输出:

C:\Users\myuser\repos\test>vagrant up
There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.

Path: C:/Users/myuser/repos/test/Vagrantfile
Line number: /Users/myuser/repos/test/Vagrantfile
Message: NameError: undefined local variable or method `foo' for main:Object

使用 Vagrant 版本 1.7.4。


编辑:在 Mac OS X 上使用相同的版本 1.7.4,错误消息应该是:

$ vagrant up
There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.

Path: /Users/myuser/repos/vagrant-test/Vagrantfile
Line number: 4
Message: NameError: undefined local variable or method `foo' for main:Object

所以这似乎是 Windows 唯一的问题。


Edit2:我现在已经打开了一个关于它的bug report,因为我想不出任何其他解释。

这是 confirmed as a bug and fixed in the trunk