Magento 2 Command line throw errors in developer mode
-
19-01-2021 - |
سؤال
In production mode, my website is working fine. But as soon as I enable developer mode, I can not use command line any more.
In developer mode, if I use for example php bin/magento cache:flush
, I'll get the following error.
Invalid Document
Element 'virtualType', attribute 'name': [facet 'pattern'] The value '01' is not accepted by the pattern '(\\?[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)(\\[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)*'.
Line: 23
Element 'virtualType', attribute 'name': '01' is not a valid value of the atomic type 'phpClassName'.
Line: 23
Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either invalid or something strange happend.
Line: 23
This happens to every command I use in developer mode. What happened?
المحلول
with an IDE, find the string <virtualType name="
in your app/code folder
or also by command-line grep -R '<virtualType name="' app/code
and then one of these declarations will likely have an empty name or invalid character.
If app/code does not give anything, you may have to do the same in vendor folder but less likely
if this is not easy because there are a lot of di.xml. You may disable one by one the installed third-party modules and flush the cache, try again..