Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vagrant 设置可能不存在的同步文件夹_Vagrant_Vagrantfile - Fatal编程技术网

Vagrant 设置可能不存在的同步文件夹

Vagrant 设置可能不存在的同步文件夹,vagrant,vagrantfile,Vagrant,Vagrantfile,在我的Vagrant文件中,我设置了一个同步文件夹,例如 node_config.vm.synced_folder "../.", "/proj_root" 这个很好用。我想添加主机上可能不存在源目录的其他同步文件夹。当vagrant运行时,它报告找不到源目录 There are errors in the configuration of this machine. Please fix the following errors and try again: vm: * The host

在我的Vagrant文件中,我设置了一个同步文件夹,例如

node_config.vm.synced_folder "../.", "/proj_root"
这个很好用。我想添加主机上可能不存在源目录的其他同步文件夹。当vagrant运行时,它报告找不到源目录

There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The host path of the shared folder is missing: ../../test_no_such_dir
我理解这个错误,但是,我正在寻找一种可以选择设置synced_文件夹的方法。如果目录不存在,也许我可以在目录上运行mkdir来创建它们,但我不确定是否可以在Vagrant文件中运行任意命令。

我可以使用这些命令。其中之一是
create
,如果源目录不存在,它将创建源目录

node_config.vm.synced_folder "../../test_no_such", "/test_no_such", create:true