Symfony 4 缓存:没有这样的文件或目录 [英] Symfony 4 Cache: No such file or directory

查看:59
本文介绍了Symfony 4 缓存:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 symfony 4 创建一个新项目.项目文件夹是通过默认的 symfony 4 骨架项目composer create-project symfony/website-skeleton test创建的.

i try to create a new project with symfony 4. The project folder is created via the default symfony 4 skelleton project composer create-project symfony/website-skeleton test.

这是命令的输出:

composer create-project symfony/website-skeleton test
Installing symfony/website-skeleton (v3.4.4)
  - Installing symfony/website-skeleton (v3.4.4): Loading from cache
Created project in test
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 89 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.2.0): Loading from cache
  - Installing symfony/flex (v1.0.70): Loading from cache
  - Installing doctrine/lexer (v1.0.1): Loading from cache
  - Installing doctrine/inflector (v1.2.0): Loading from cache
  - Installing doctrine/collections (v1.4.0): Loading from cache
  - Installing doctrine/cache (v1.6.2): Loading from cache
  - Installing doctrine/annotations (v1.4.0): Loading from cache
  - Installing doctrine/common (v2.7.3): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.7.0): Loading from cache
  - Installing symfony/yaml (v3.4.4): Loading from cache
  - Installing symfony/webpack-encore-pack (v1.0.2): Loading from cache
  - Installing psr/link (1.0.0): Loading from cache
  - Installing fig/link-util (1.0.0): Loading from cache
  - Installing symfony/web-link (v3.4.4): Loading from cache
  - Installing symfony/filesystem (v3.4.4): Loading from cache
  - Installing symfony/config (v3.4.4): Loading from cache
  - Installing symfony/http-foundation (v3.4.4): Loading from cache
  - Installing symfony/event-dispatcher (v3.4.4): Loading from cache
  - Installing psr/log (1.0.2): Loading from cache
  - Installing symfony/debug (v3.4.4): Loading from cache
  - Installing symfony/http-kernel (v3.4.4): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/dependency-injection (v3.4.4): Loading from cache
  - Installing egulias/email-validator (2.1.3): Loading from cache
  - Installing swiftmailer/swiftmailer (v6.0.2): Loading from cache
  - Installing symfony/swiftmailer-bundle (v3.2.0): Loading from cache
  - Installing symfony/translation (v3.4.4): Loading from cache
  - Installing symfony/validator (v3.4.4): Loading from cache
  - Installing symfony/serializer (v3.4.4): Loading from cache
  - Installing symfony/inflector (v3.4.4): Loading from cache
  - Installing symfony/property-info (v3.4.4): Loading from cache
  - Installing symfony/property-access (v3.4.4): Loading from cache
  - Installing psr/simple-cache (1.0.0): Loading from cache
  - Installing psr/cache (1.0.1): Loading from cache
  - Installing symfony/polyfill-apcu (v1.7.0): Loading from cache
  - Installing symfony/cache (v3.4.4): Loading from cache
  - Installing webmozart/assert (1.3.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
  - Installing symfony/serializer-pack (v1.0.1): Loading from cache
  - Installing symfony/security (v3.4.4): Loading from cache
  - Installing symfony/security-bundle (v3.4.4): Loading from cache
  - Installing symfony/process (v3.4.4): Loading from cache
  - Installing monolog/monolog (1.23.0): Loading from cache
  - Installing symfony/monolog-bridge (v3.4.4): Loading from cache
  - Installing symfony/monolog-bundle (v3.1.2): Loading from cache
  - Installing symfony/routing (v3.4.4): Loading from cache
  - Installing symfony/finder (v3.4.4): Loading from cache
  - Installing symfony/class-loader (v3.4.4): Loading from cache
  - Installing symfony/framework-bundle (v3.4.4): Loading from cache
  - Installing symfony/console (v3.4.4): Loading from cache
  - Installing zendframework/zend-eventmanager (3.2.0): Loading from cache
  - Installing zendframework/zend-code (3.1.0): Loading from cache
  - Installing ocramius/proxy-manager (2.0.4): Loading from cache
  - Installing doctrine/dbal (v2.5.13): Loading from cache
  - Installing doctrine/migrations (v1.5.0): Loading from cache
  - Installing symfony/doctrine-bridge (v3.4.4): Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.2): Loading from cache
  - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
  - Installing doctrine/doctrine-bundle (1.8.1): Loading from cache
  - Installing doctrine/doctrine-migrations-bundle (v1.3.1): Loading from cache
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing doctrine/orm (v2.5.14): Loading from cache
  - Installing symfony/orm-pack (v1.0.5): Loading from cache
  - Installing symfony/options-resolver (v3.4.4): Loading from cache
  - Installing symfony/polyfill-intl-icu (v1.7.0): Loading from cache
  - Installing symfony/intl (v3.4.4): Loading from cache
  - Installing symfony/form (v3.4.4): Loading from cache
  - Installing symfony/expression-language (v3.4.4): Loading from cache
  - Installing symfony/var-dumper (v3.4.4): Loading from cache
  - Installing symfony/phpunit-bridge (v3.4.4): Loading from cache
  - Installing twig/twig (v2.4.4): Loading from cache
  - Installing symfony/twig-bridge (v3.4.4): Loading from cache
  - Installing symfony/web-profiler-bundle (v3.4.4): Loading from cache
  - Installing symfony/twig-bundle (v3.4.4): Loading from cache
  - Installing symfony/stopwatch (v3.4.4): Loading from cache
  - Installing symfony/profiler-pack (v1.0.3): Loading from cache
  - Installing easycorp/easy-log-handler (v1.0.4): Loading from cache
  - Installing symfony/debug-bundle (v3.4.4): Loading from cache
  - Installing symfony/debug-pack (v1.0.4): Loading from cache
  - Installing symfony/asset (v3.4.4): Loading from cache
  - Installing sensio/framework-extra-bundle (v5.1.6): Loading from cache
  - Installing symfony/dom-crawler (v3.4.4): Loading from cache
  - Installing symfony/browser-kit (v3.4.4): Loading from cache
  - Installing symfony/css-selector (v3.4.4): Loading from cache
  - Installing symfony/dotenv (v3.4.4): Loading from cache
  - Installing symfony/maker-bundle (v1.1.1): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 20 recipes (2f96d696d346819d6ba100d95252f4e1)
  - Configuring symfony/flex (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/framework-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring doctrine/annotations (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/webpack-encore-pack (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/swiftmailer-bundle (>=2.5): From github.com/symfony/recipes:master
  - Configuring symfony/translation (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/security-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/monolog-bundle (>=3.1): From github.com/symfony/recipes:master
  - Configuring symfony/routing (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/console (>=3.3): From github.com/symfony/recipes:master
  - Configuring doctrine/doctrine-cache-bundle (>=1.3.2): From auto-generated recipe
  - Configuring doctrine/doctrine-bundle (>=1.6): From github.com/symfony/recipes:master
  - Configuring doctrine/doctrine-migrations-bundle (>=1.2): From github.com/symfony/recipes:master
  - Configuring symfony/phpunit-bridge (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/web-profiler-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/twig-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring easycorp/easy-log-handler (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/debug-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring sensio/framework-extra-bundle (>=4.0): From github.com/symfony/recipes:master
  - Configuring symfony/maker-bundle (>=1.0): From github.com/symfony/recipes:master
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  
!!  In Kernel.php line 865:
!!                                                                                 
!!    Warning: unlink(/home/fmk/Code/test/var/cache/dev/ContainerS8fduda.legacy):  
!!     No such file or directory                                                   
!!                                                                                 
!!  
!! 

即使调用 php bin/console cache:clear 我也遇到同样的错误:

Even when calling php bin/console cache:clear i get the same error:

php bin/console cache:clear

In Kernel.php line 865:

  Warning: unlink(/home/fmk/Code/test/var/cache/dev/ContainerS8fduda.legacy): No such file or directory  

即使手动删除 var/cache 中的文件/文件夹,然后再次尝试清除缓存,错误也不会消失:

Even after deleting the files/folders in var/cache by hand and then trying to clear the cache again the error does not dissappear:

$ sudo rm -rf var/cache/*
$ php bin/console cache:clear

In Kernel.php line 865:

  Warning: unlink(/home/fmk/Code/test/var/cache/dev/ContainerS8fduda.legacy): No such file or directory

如果我尝试在应用程序中打开路由,我会遇到与尝试调用 cache:clear 时抛出的错误相同的错误.

If i try to open a route in the application i get the same error as the one thrown when trying to call cache:clear.

如果我尝试创建丢失的文件,它会抛出一个新的错误,新文件无法取消链接.这些是迄今为止出现的文件:

If i try to create the missing file it throws a new error with a new file that can not be unlinked. These are the files that have come up so far:

  • var/cache/dev/ContainerS8fduda.legacy
  • var/cache/de_
  • var/cache/de~
  • var/cache/de_/ContainerS8fduda.legacy
  • ...

我不知道还能做些什么来让应用程序运行...

I dont know what else to do to get the app running...

有没有人知道如何解决这个问题?

Has anyone a idea on what to do to fix this problem?

谢谢!

更新:我创建了一个 shell 脚本来创建所有丢失"的文件:

UPDATE: I created a shell script to create all the files that are "missing":

#!/bin/bash

rm -rf var/cache/*

mkdir var/cache/dev
touch var/cache/dev/ContainerToyerun.legacy
touch var/cache/dev/ContainerToyerun.legacy
touch var/cache/de~
mkdir var/cache/de_
touch var/cache/de_/ContainerToyerun.legacy

这让我可以对应用程序发出一个请求,但之后 ContainerToyerun.legacy 文件有一个新名称,我需要为新请求编辑脚本!

This lets enables me to make one request against the application but after that the ContainerToyerun.legacy file has a new name and i need to edit the script for a new request!

推荐答案

删除 vendor/并重新安装 composer 并不能解决问题,在你的 php.ini(或 20-xdebug.ini 符号链接到/etc/php/(YOUR PHP VERSION)/mods-available/xdebug.ini 中禁用 xdebug.scream 解决了这个问题)

Removing vendor/ and reinstalling composer will not solve the issue, the issue is solved disabling xdebug.scream in your php.ini (or 20-xdebug.ini which symlinks to /etc/php/(YOUR PHP VERSION)/mods-available/xdebug.ini )

这篇关于Symfony 4 缓存:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆