1

I have updated Composer to 2.4.4 as a prerequisite to updating Magento to 2.4.5, however now I'm getting errors in SSH when trying to run any other command and HTTP on a page execution:

SSH:

In AutoloadGenerator.php line 1351:

require(/home/---/web/---/public_html/vendor/magento/composer-root-update-plugin/registration.php): failed to open stream: No such file or directory

HTTP:

Warning: require(/home/---/web/---/public_html/vendor/composer/../magento/composer-root-update-plugin/registration.php): failed to open stream: No such file or directory in /home/xadmin/web/xdev.devsetup.co.uk/public_html/vendor/composer/autoload_real.php on line 59

Fatal error: require(): Failed opening required '/home/---/web/---/public_html/vendor/composer/../magento/composer-root-update-plugin/registration.php' (include_path='/home/xadmin/web/xdev.devsetup.co.uk/public_html/vendor/magento/zendframework1/library:.:/usr/share/php') in /home/---/web/---/public_html/vendor/composer/autoload_real.php on line 59

Composer won't rollback - tried that and received the same errors. Confirmed the file doesn't exist, but the directory does.

I'm assuming /public_html/vendor/composer/../magento/composer-root-update-plugin/ in the HTTP error is the same as /public_html/vendor/magento/composer-root-update-plugin/ in SSH, but posted in case it helps you help me.

Does anyone know how I can get past this?

Thanks

myshadowself
  • 208
  • 2
  • 10

3 Answers3

2

You don't need to upgrade to Magento 2.4.4 before upgrading to Magento 2.4.5. You can upgrade to Magento 2.4.5 directly.

Solution 1: Try the following steps to upgrade your Magento site to 2.4.5-p1:

  1. Switch back to your old PHP version, ie. PHP 7.4 or 7.3
  2. Run the following commands:
composer require magento/composer-root-update-plugin ~2.0 --no-update
composer update
rm -rf var/cache/* var/page_cache/* generated/*
bin/magento setup:upgrade
composer require-commerce magento/product-community-edition 2.4.5-p1 --no-update
composer update
  1. Change to PHP version 8.1
  2. Run the following commands:
rm -rf var/cache/* var/page_cache/* generated/*
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f

Solution 2: (This solution resolved the issue for @myshadowself)

Take the following steps:

  1. Remove vendor directory and clear composer cache:
rm -rf vendor
composer clear-cache
  1. Update require-dev section in your composer.json file same as the Magento codebase: https://github.com/magento/magento2/blob/2.4.5-p1/composer.json#L108

  2. Remove manually magento/composer-root-update-plugin from require in composer.json

  3. Run thee following commands:

composer remove magento/product-community-edition --no-update
composer require-commerce magento/product-community-edition 2.4.5-p1 --no-update
composer update
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f

You're done.

Troubleshooting:

If you had the below error when running bin/magento setup:upgrade

"Class "Vertex\Tax\Setup\Schema\Triggers\MigrateVertexInvoiceSent" not found#0 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject()"

Remove generated folder then run bin/magento setup:upgrade again:

rm -rf generated
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
Tu Van
  • 6,868
  • 2
  • 11
  • 22
  • I was hoping you'd drop by Tu Van, I've been watching your bug hunts for a while! Currently on my way home, but I'll try this in the morning. Thanks :) – myshadowself Nov 09 '22 at 16:59
  • 1
    Yeah, hope that helps you resolve your issue. If you have any issues, feel free to let me know. – Tu Van Nov 09 '22 at 17:02
  • Hi I get as far as composer require-commerce magento/product-community-edition 2.4.5-p1 --no-update but receive new errors:

    Posted below...

    – myshadowself Nov 10 '22 at 11:13
  • Deprecation Notice: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/--/web/--/public_html/vendor/magento/composer-root-update-plugin/Utils/PackageUtils.php:128

    In RootPackageRetriever.php line 517:

    – myshadowself Nov 10 '22 at 11:14
  • [TypeError]
    Magento\ComposerRootUpdatePlugin\Updater\RootPackageRetriever::getOriginalEdition(): Return value must be of type string, null returned
    – myshadowself Nov 10 '22 at 11:14
  • an exception trace too big to post as a comment.
  • I'm now running PHP 8.1.

    Any ideas?

    – myshadowself Nov 10 '22 at 11:16
  • 1
    did you run composer require magento/composer-root-update-plugin ~2.0 --no-update before? – Tu Van Nov 10 '22 at 11:24
  • Which Magento version you are using before this upgrade? – Tu Van Nov 10 '22 at 11:27