gpt4 book ai didi

php - Vagrant 与 Symfony 3.3 : Failed to remove directory

转载 作者:可可西里 更新时间:2023-10-31 22:49:50 24 4
gpt4 key购买 nike

尝试使用 Flex 设置 Symfony 3.3 环境。目前,当尝试要求一些像下面这样的包时:

composer req annotations security orm template asset validator

一切顺利,除了 cache:clear 我收到以下错误:

!!    [Symfony\Component\Filesystem\Exception\IOException]                         
!! Failed to remove directory "/home/vagrant/Code/multi-user-gallery-blog/var/
!! cache/loca~/pools": rmdir(/home/vagrant/Code/multi-user-gallery-blog/var/ca
!! che/loca~/pools): Directory not empty.

我已经尝试过手动删除文件夹,但是那些是在安装过程中自动生成的,然后 Symfony 无法删除它们。

我在 Vagrant Homestead 上运行它。

关于如何解决这个问题有什么想法吗?

最佳答案

这是 an issue使用 Vagrant/VirtualBox 在主机和 guest 计算机之间映射共享文件夹的方式。在 Symfony 项目中,缓存目录通常位于从主机同步的项目目录中。

我们可以change the cache directory通过向 app/AppKernel.php 类添加覆盖方法,使用 guest 计算机文件系统中的位置来避免这些问题:

class AppKernel extends Kernel 
{
...
public function getCacheDir()
{
if ($this->environment === 'local') {
return '/tmp/symfony/cache';
}

return parent::getCacheDir();
}
}

上面的示例演示了我们如何为本地开发环境设置自定义缓存目录,同时保留生产环境的默认行为。 /tmp/symfony/cache 只是一个例子。我们可以选择应用程序有权写入的客户机文件系统上的任何位置。将 'local' 替换为项目用于开发的环境名称。

关于php - Vagrant 与 Symfony 3.3 : Failed to remove directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47251942/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com