简体   繁体   中英

Symfony 5.2 Error: The directory “var/cache/dev/jms_serializer” does not exist

Symfony 5.2 with jms/serializer-bundle 3.7.0.

After symfony cache cleaning by command cache:clear on the next request I get an error:

The directory "var/cache/dev/jms_serializer" does not exist

I noticed that for symfony 4.4 $dir variable has var/cache/de_/jms_serializer value, but for symfony 5.2 has var/cache/dev/jms_serializer

So when symfony 5.2 runs warn up, JMSSerializerBundle creates jms_serializer folder in var/cache/dev instead of var/cache/de_

serializer config:

jms_serializer:
    visitors:
        xml_serialization:
        format_output: '%kernel.debug%'
    property_naming:
        id: 'jms_serializer.identical_property_naming_strategy'

Try to just remove cache directory.

rm -rf var/cache

And create it with php user:

sudo su www-data // Login as php user
mkdir var/cache // create cache directory
chown -R $USER:$USER var/cache // Change owner of cache directory

where instead of www-data is the user which run your php.

PS I am not fully sure, but there is no var/de directory neither for symfony, neither for serializer. It is just an temporary directory created by symfony while clearing cache process, which is usually removed after successful finish

The problem is fixed in symfony 5.2.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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