简体   繁体   English

Symfony中与操作系统无关的供应商路径

[英]OS independent vendor path in Symfony

I'm developing a Symfony 2.7 application on a Windows machine. 我正在Windows机器上开发Symfony 2.7应用程序。 I'm using a vagrant VM running Ubuntu Linux (Apache) to run the code. 我正在使用运行Ubuntu Linux(Apache)的无聊的VM来运行代码。 The code is mounted as a synced folder into the Linux system. 该代码作为同步文件夹安装到Linux系统中。

When I access my application on the linux host it looks like Symfony is trying to use the Windows path to find the vendor directory: 当我在Linux主机上访问应用程序时,Symfony似乎正在尝试使用Windows路径查找供应商目录:

ContextErrorException in /var/www/project/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 131:

Warning: file_get_contents(D:\workspace\project\vendor\symfony\symfony\src\Symfony
\Bundle\TwigBundle/Resources/views/Exception/exception_full.html.twig): failed to open
stream: No such file or directory

I don't think this is specific to vagrant, It looks like the problem would be the same for anybody working on a remote drive. 我不认为这是专门针对无业游民的,看来问题对任何在远程驱动器上工作的人来说都是一样的。

How did you guys make this work? 你们是如何做到这一点的?

I'm fairly new to Symfony, any help would be greatly appreciated, thank you. 我对Symfony还是相当陌生,非常感谢您的帮助。

I found the issue myself. 我自己发现了问题。 This worked for me... 这对我有用...

Add this to your composer.json: 将此添加到您的composer.json中:

"config": {
    [...]
    "vendor-dir": "vendor"
},

Update composer and clear Symfony cache. 更新作曲家并清除Symfony缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM