Vagrant错误:NFS报告您的导出文件无效

Hun*_*ter 94 nfs export vagrant discourse

我正在尝试使用这些说明设置Discourse开发环境.但是,当我运行Vagrant时,我得到错误:

NFS报告您的导出文件无效.在对文件进行任何更改之前,Vagrant会进行此检查.请更正以下问题并执行"vagrant reload":

无法打开/ etc/exports

我查了一下,而且我没有etc/exports文件夹,所以我创建了一个并运行了vagrant reload.这让我:

/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/hosts/bsd/host.rb:146:in read': Is a directory - /etc/exports (Errno::EISDIR) from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/hosts/bsd/host.rb:146:innfs_prune'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/ plugins/synced_folders/nfs/synced_folder.rb:68:in cleanup' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/synced_folder_cleanup.rb:24:inblock in call'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/synced_folder_cleanup.rb:22:in each_key' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/synced_folder_cleanup.rb:22:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/prepare_nfs_valid_ids.rb:12:incall' .1/lib/vagrant/action/warden.rb:34:call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb:118:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb:30:in来电'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/env_set.rb:19:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4. 1/lib/vagrant/action/warden.rb:34:call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/provision.rb:52:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/clear_forwarded_ports.rb:13:incall'来自/ Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/set_name.rb:19:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34 :call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/clean_machine_folder.rb:17:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/check_accessible.rb:18:in来自/ Applications/Vagrant/embedded/gems/gems/vagrant -1.4.1/lib/vagrant/action/warden.rb:34:inizeize_action call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:95:in' 中的块来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb: 34:来自/ Applications/Vagrant/embedded/gems /的call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builder.rb:116:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:inblock in run' gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19:in run'from busy' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call .rb:51:call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:95:in block in finalize_action' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in来自/ Applications/Vagrant/embedded/gems /gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builder.rb:116:in来自'来自' /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in block in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19:inbusy'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/ lib/vagrant/action/runner.rb:69:in call'from run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:51:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:ininizeize_action call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:95:in'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1 /lib/vagrant/action/builder.rb:116:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in在运行中阻止来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19:in busy' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:inrun 'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:51:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:incall'from/Applications/Vagrant/embedded/gems/gems/vagrant- 1.4.1/lib/vagrant/action/builtin/config_validate.rb:25:call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/check_virtualbox.rb :17:call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in来自/ Applications/Va的电话 grant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:57:in call'from call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins /providers/virtualbox/action/check_virtualbox.rb:17:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/config_validate.rb:25:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in来电'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:95:in block in finalize_action' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:incall'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4. 1/lib/vagrant/action/warden.rb:34:call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builder.rb:116:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in block in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19:inbusy'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builtin/call.rb:51:in来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1 /lib/vagrant/action/warden.rb:34:in call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in"从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/warden.rb:34:in电话call' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/builder.rb:116:in呼叫"从/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/li b/vagrant/action/runner.rb:69:block in run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/util/busy.rb:19:in忙于'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/action/runner.rb:69:in action'from run' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/machine.rb:147:in/应用程序/ Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/commands/reload/command.rb:37:block in execute' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/plugin/v2/command.rb:193:inin_target_vms 中的块,来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1 /lib/vagrant/plugin/v2/command.rb:191:in each' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/plugin/v2/command.rb:191:inwith_target_vms'来自/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/plugins/commands/reload/command.rb:36:in execute' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/cli.rb:38:in执行'from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/lib/vagrant/environment.rb:484:in cli' from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.1/bin/vagrant:127:in'来自/Applications/Vagrant/bin/../embedded/gems/bin/vagrant: 23:在load' from /Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in'

我在Mac上(OS X 10.6.8).我该如何解决?我尝试搜索原始错误消息,我发现的只是一些包含抛出它的Vagrant源代码的存储库.

tot*_*tas 329

我的VirtualBox安装中安装了一些以前的图像/盒子,所以已经有一些无效的条目/etc/exports了.所以我必须清理该文件并重新启动我的Vagrant框.

NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct
the issues below and execute "vagrant reload":
Run Code Online (Sandbox Code Playgroud)

这是我在主机上做的事情:

sudo rm /etc/exports
sudo touch /etc/exports

vagrant halt
vagrant up --provision
Run Code Online (Sandbox Code Playgroud)

  • 或者不是全部删除,只需删除与那些不再存在的那些VM相关的所有行. (31认同)
  • 这是最适用的一个,因为我有两个安装相同文件夹的流浪盒.他们感到困惑! (9认同)
  • 值得一提的是,该命令应该在主机上执行.因为流浪盒实际上已经启动了,我可以登录到它,但找不到/ etc/exports文件.因为它在主机上. (4认同)
  • 我不确定在最后一个命令中是否需要`--provision`标志,因为通常NFS安装在`up`而不是配置时.在您的设置中可能需要它,但这些步骤对我来说没有那个标志. (3认同)
  • 重命名项目目录名称后,我遇到了这个问题.谢谢!:) (2认同)
  • 或者你可以简单地用正确的路径编辑文件 (2认同)

col*_*nig 79

我在OS X 10.9 Mavericks(13A603)上遇到了Vagrant 1.4.1和VirtualBox 4.3.6这个问题.我能够通过一个简单的命令来修复它,以创建缺少的/ etc/exports文件.在OS X上运行,而不是guest,如下面的评论所述.

$ sudo touch /etc/exports
Run Code Online (Sandbox Code Playgroud)

然后我才能成功运行vagrant up.我确实遇到了另一个错误,其中Guest Additions不是最新的,但我通过安装vagrant-vbguest插件修复了这个问题.

$ vagrant plugin install vagrant-vbguest
Run Code Online (Sandbox Code Playgroud)

然后一个快速的vagrant reload我开始运行!

  • 我还必须编辑我的/ etc/exports文件,因为它有多个条目混淆了流浪汉. (5认同)
  • 非常好的提示,这必须在Mac主机上完成...不是我第一次尝试的客人 (4认同)

Kev*_* G. 23

对我来说,这个错误开始出现在一个有效的Vagrant环境中.

我已经重命名了Vagrant运行的目录.为了修复它,我运行'sudo vi/etc/exports'并修复了路径名,使其指向我当前的目录.


col*_*ner 9

这样的事情我也经历过.我从另一个项目复制了我的Vagrantfile,忘了更改NFS设置.这导致当前VM挂载我复制原始Vagrantfile的VM的父文件夹.所以我这样做了:

vagrant halt
vagrant up
Run Code Online (Sandbox Code Playgroud)

仍然有同样的错误.所以我跟踪了位于/ etc/exports的导出文件,如下所示:

# VAGRANT-BEGIN: 501 64e10d4d-342e-4f55-b69a-97edda35742f
"/Users/[username]/vagrant" 192.168.11.12 -alldirs -mapall=501:20
# VAGRANT-END: 501 64e10d4d-342e-4f55-b69a-97edda35742f
# VAGRANT-BEGIN: 501 b3c6e7fe-95d4-48db-8876-c89d3e07af8d
"/Users/[username]/Sites/molitech-oms" 192.168.11.124 -alldirs -mapall=501:20
# VAGRANT-END: 501 b3c6e7fe-95d4-48db-8876-c89d3e07af8d
# VAGRANT-BEGIN: 501 3e2aabfd-ce63-441b-85a2-1b51e8beb863
"/Users/[username]/Sites/app" 192.168.11.125 -alldirs -mapall=501:20
# VAGRANT-END: 501 3e2aabfd-ce63-441b-85a2-1b51e8beb863
# VAGRANT-BEGIN: 501 ff92e353-9f6d-48ee-9d76-e29b33f1dd60
"/Users/[username]/Sites" 192.168.11.126 -alldirs -mapall=501:20
# VAGRANT-END: 501 ff92e353-9f6d-48ee-9d76-e29b33f1dd60
Run Code Online (Sandbox Code Playgroud)

最后两条路径是相同的.所以我删除了最后三行并运行:

vagrant halt && vagrant up
Run Code Online (Sandbox Code Playgroud)

现在一切似乎都运转正常.

OSX 10.11.1 Vagrant 1.7.4


bro*_*ger 8

我不想经历降级的麻烦.这就是我所做的(仍然需要一段时间,但比降级恕我直言的麻烦更少):

  1. 在VM Vagrantfile中,对于任何已同步的文件夹,禁用NFS

    config.vm.synced_folder ".", "/vagrant", nfs: false

  2. 删除了/ etc/exports

    sudo mv /etc/exports ~/Desktop/exports

  3. 重写/ etc/exports

    vagrant up

  4. 如果您希望/需要在VM上启用NFS,请重新启用NFS

    config.vm.synced_folder ".", "/vagrant", nfs: true


Mil*_*anG 6

只需运行以下命令:

sudo rm /etc/exports
sudo touch /etc/exports
vagrant reload
Run Code Online (Sandbox Code Playgroud)

不要使用vagrant up --provision,如果你不知道,这将您的项目不覆盖当前状态。


Loc*_*yer -33

尝试使用 Discourse 中提到的 VirtualBox 和 Vagrant 的已知良好版本作为您的第一个 Rails 应用程序

我在 Mac (OS X 10.9 (Mavericks)) 上遇到了同样的问题,但回滚到这些版本似乎解决了我的问题。

  • 这是一个误导性的答案。请选择 colinhoemig 的答案,因为它更有帮助! (5认同)
  • 不需要降级。您只需要运行“sudo touch /etc/exports”。请参阅[colinhoernig的回答](http://stackoverflow.com/a/20750058/134014)。另外,我刚刚将我的 vagrant 安装更新到 v1.4.3,将 VirtualBox 更新到 v4.3.8,这似乎解决了我的问题。 (3认同)
  • 答案没有建设性且具有误导性。我想知道它是如何标记为正确的。正确答案是@colinhoernig,已被投票超过 50 次。为了解决错误。您需要修复 /etc/exports 文件。然后再次构建。 (3认同)