We recently upgrade to the latest version of Magento 2 i.e. 2.2.3 and when we run the compile command (setup:di:compile) via SSH then received the following compilation error -:
Errors during compilation:
MagentoBackendModelViewLayoutGeneratorPool
Incompatible argument type: Required type: MagentoFrameworkViewLayoutConditionConditionFactory. Actual type: MagentoFrameworkAppConfigScopeConfigInterface; File:
/home/scommerc/public_html/magento2/vendor/magento/module-backend/Model/View/Layout/GeneratorPool.php
Total Errors Count: 1
[MagentoFrameworkValidatorException]
Error during compilation
After spending a lot of time we figured it out that there is one file which needs to be removed after the upgrade especially when you are upgrading from old version to new version (i.e. 2.2.3) because this file doesn’t exist in the latest version.
vendor/magento/module-backend/Model/View/Layout/GeneratorPool.php
The best way to upgrade to latest version of Magento 2 to run the following command line instead of copy the files directly on the server -:
composer require <product> <version> --no-update
composer update
For Magento community -:
composer require magento/product-community-edition 2.2.3 --no-update
composer update
For Magento enterprise -:
composer require magento/product-enterprise-edition 2.2.3 --no-update
composer update
Hope this article helped you in some way. Please leave us your comment and let us know what do you think? Thanks.