laravel 共享文件夹的主机路径丢失:~/Code
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28558113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The host path of the shared folder is missing: ~/Code
提问by Xeen
I'd like to use laravel homestead
for my development machine and installed virtualbox and vagrant successfully, but when I run vagrant up
I get this error:
我想laravel homestead
用于我的开发机器并成功安装了 virtualbox 和 vagrant,但是当我运行时出现vagrant up
此错误:
Bringing machine 'default' up with 'virtualbox' provider...
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: ~/Code
The Homestead.yaml
file looks like this:
该Homestead.yaml
文件如下所示:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
hhvm: true
databases:
- homestead
variables:
- key: APP_ENV
value: local
These are the default settings, but they don't really work for my machine - I don't even have /home/vagrant
folder nor do I have ~/Code
anywhere where I can see. I'm using ubuntu 12.04
- can you please point me to how I should configure my settings because by the official documentation I'm kind of lost.
这些是默认设置,但它们并不真正适用于我的机器 - 我什至没有/home/vagrant
文件夹,也没有~/Code
任何可以看到的地方。我正在使用ubuntu 12.04
- 你能指出我应该如何配置我的设置,因为根据官方文档我有点迷失了。
回答by trogne
Inside the homestead directory, you have to run the command bash init.sh
.
在 homestead 目录中,您必须运行命令bash init.sh
.
This will generate the Homestead.yaml
file (and after.sh
and aliases
) inside your home directory (~
).
这将在您的主目录 ( ) 中生成Homestead.yaml
文件(和after.sh
和)。aliases
~
If you are changing Homestead.yaml
again, you have to re-run bash init.sh
again. It will ask for overwrite, say yes.
如果Homestead.yaml
再次更改,则必须重新运行bash init.sh
。它会要求覆盖,说是。
(and as mentioned in other answers, be sure that the directory for folders: - map:
exists)
(并且如其他答案中所述,请确保目录folders: - map:
存在)
回答by adis
In your Ubuntu machine you have to let Homestead know where your actual code is located. Example:
在你的 Ubuntu 机器上,你必须让 Homestead 知道你的实际代码所在的位置。例子:
If you code is located in a seperate partition called WORKSPACE you need to type the following:
如果您的代码位于名为 WORKSPACE 的单独分区中,您需要键入以下内容:
- map: /Volumes/WORKSPACE/YourProject
to: /home/vagrant/Code
回答by Maxwellt
In Windows case I used this:
- map: e:/GIT/PHP/mathmaps/Code
to: /home/vagrant/Code
在 Windows 的情况下,我使用了这个:
- 映射:e:/GIT/PHP/mathmaps/Code
到:/home/vagrant/Code
P.S. GIT is my workspace folder
PS GIT 是我的工作区文件夹
回答by Harry Bosh
running bash init.sh a second time will prompt to overwrite the initial setup, this will also output the directory path you require to edit the correct Homestead.yaml file.
第二次运行 bash init.sh 将提示覆盖初始设置,这也会输出编辑正确 Homestead.yaml 文件所需的目录路径。
回答by Gabriel
The map: attribute has to be set to the location to where you want to keep your code. For example, I will be saving my code in a folder called code within the Homestead folder therefore, map is:
map: 属性必须设置为您想要保存代码的位置。例如,我将我的代码保存在 Homestead 文件夹中名为 code 的文件夹中,因此,地图是:
folders:
- map: ~/Development/Homestead/Code
to: /home/vagrant/Code
Where 'Development' is simply a folder in my home directory where I keep all my code
“开发”只是我主目录中的一个文件夹,我保存所有代码