简体   繁体   English

Vagrant + Symfony2环境ContextErrorException怪异

[英]Vagrant + Symfony2 Environment ContextErrorException Weirdness

I've never had a problem with either Symfony2 or Vagrant before this point and I'm absolutely lost as to what is happening. 在此之前我从来没有遇到过Symfony2或Vagrant的问题,而且我对于发生的事情我完全迷失了。

Without any warning my environment died completely and will only produce the following error: 没有任何警告我的环境完全死亡,只会产生以下错误:

ContextErrorException: Warning: 
file_get_contents(/Users/Paul/Sites/Project/htdocs/project-web/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig): 
failed to open stream: No such file or directory in /var/www/project-web/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 130

The reason this is strange is that Symfony is referring to my local file system... 这很奇怪的原因是Symfony指的是我的本地文件系统......

/Users/Paul/Sites/Project/htdocs/project-web/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig

....instead of the box environement which is running Ubuntu, then referring to the unix filesystem location of 'Filesystem.php'... ....而不是运行Ubuntu的box environement,然后引用'Filesystem.php'的unix文件系统位置...

/var/www/project-web/vendor/twig/twig/lib/Twig/Loader/Filesystem.php

I cannot get past this screen. 我无法通过这个屏幕。 I have just created a brand new environment and packaged it as a its own box, then using that box I still get this error. 我刚刚创建了一个全新的环境并将其打包为一个自己的盒子,然后使用该盒子我仍然会收到此错误。

Can anyone help? 有人可以帮忙吗?

My first guess is you have run it locally first and the paths are in the cache. 我的第一个猜测是你先在本地运行它,路径在缓存中。 If so it should be fixed by running the following in your vagrant environment: 如果是这样,应该通过在流浪环境中运行以下命令来修复它:

php app/console cache:clear

Add --env=prod if you are running the app.php rather then app_dev.php. 如果您正在运行app.php而不是app_dev.php,请添加--env=prod

Always use the command line IN your vagrant box (via ssh), never cmd on the windows path. 始终在您的流浪盒中使用命令行(通过ssh),从不在Windows路径上使用cmd。

vagrant up
vagrant ssh
... some auth ...
cd /your/project/path
php app/console ...

I'm using Homestead with Symfony 3.1. 我正在使用Homestead和Symfony 3.1。

I had to delete var/cache folder from the root of my project in the host machine. 我不得不从主机中项目的根目录中删除var/cache文件夹。

rm -rf var/cache/ solved it. rm -rf var/cache/解决了它。

Before, I tried out php app/console cache:clear with no results. 以前,我尝试了php app/console cache:clear没有结果。

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

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