【发布时间】:2015-10-27 11:54:14
【问题描述】:
我的 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 版。
编辑:在使用相同版本 1.7.4 的 Mac OS X 上,错误消息应为:
$ 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,因为我想不出任何其他解释。
【问题讨论】:
-
请复制你的 Vagrantfile
-
@FrédéricHenri 它与我的 vagrantfile 无关。我拥有的任何有任何错误的流浪文件都会发生这种情况。
-
@FrédéricHenri 现在添加了一个示例文件