Laravel 宅基地未映射我的代码文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33113442/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 12:29:53  来源:igfitidea点击:

Laravel homestead not mapping my code folder

laravelvagrantvirtualboxhomestead

提问by Khalid Dabjan

I am trying to get homestead to work after following the instructions here

我正在按照此处的说明尝试让宅基地工作

I have Virtualbox 5.0.6 and Vagrant 1.7.4 on windows 8. The machine boots up fine(ish) the only problem is that my mapped folder is not present on the vm, meaning when I vagrant ssh, the directory /home/vagrant/is empty, there is no Codedirectory inside of it. This is a screenshot of the machine booting(it should keep going and saying mapping the folders and stuff):

我在 Windows 8 上有 Virtualbox 5.0.6 和 Vagrant 1.7.4。机器启动正常(ish)唯一的问题是我的映射文件夹不存在于虚拟机上,这意味着当我时vagrant ssh,目录/home/vagrant/为空,没有Code里面的目录。这是机器启动的屏幕截图(它应该继续说映射文件夹和东西):

machine booting

机器启动

And this is the content of my Homestead.yamlfile

这是我Homestead.yaml文件的内容

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: C:\Users\Khalid\.ssh\id_rsa.pub

keys:
    - C:\Users\Khalid\.ssh\id_rsa

folders:
    - map: D:\work
      to: /home/vagrant/Code

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public

databases:
    - homestead

variables:
    - key: APP_ENV
      value: local

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 93000
#       to: 9300
#     - send: 7777
#       to: 777
#       protocol: udp

Could someone please help, Thanks

有人可以帮忙吗,谢谢

EDIT: The full output of vagrant up --debugcan be found here

编辑:vagrant up --debug可以在这里找到完整的输出

回答by ShaunUK

sstarlight was on the right track. It's a path name issue. I'm on windows 8 with homestead too and you need to use the forward slashes even in your windows paths.

sstarlight 走在正确的轨道上。是路径名问题。我也在 Windows 8 上使用 homestead,即使在 Windows 路径中也需要使用正斜杠。

The below should do the trick!

下面应该可以解决问题!

authorize: C:/Users/Khalid/.ssh/id_rsa.pub

keys:
    - C:/Users/Khalid/.ssh/id_rsa

folders:
    - map: D:/work
      to: /home/vagrant/Code

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public

I would add to this that you should run the provisioning as per the other answer after you make the change by bringing your homestead up with the --provision flag set.

我想补充一点,在您通过设置 --provision 标志设置您的宅基地进行更改后,您应该按照其他答案运行配置。

回答by Abishek

Make sure and re-verify that the path for the keysand authorizeare correct and run vagrant up --provisionto re-provision the homestead setup again

确认和重新验证该路径keysauthorize正确并运行vagrant up --provision再次宅基地的设置要重新设置

回答by ssuhat

Try change

尝试改变

 D:\work to D:/work/