Skip to content

Magento 2 PHP Fatal error during setup:di:compile at 33%

Currently running Magento 2.4.1-p1. When I run setup:di:compile I’ve got this output:

Interface 'LaminasServiceManagerFactoryFactoryInterface' not found in /chroot/home/af5d329a/851f14efb2.nxcli.net/html/setup/src/Magento/Setup/Di/MagentoDiFactory.php:17
Stack trace:
#0 /chroot/home/af5d329a/851f14efb2.nxcli.net/html/vendor/composer/ClassLoader.php(444): include()
#1 /chroot/home/af5d329a/851f14efb2.nxcli.net/html/vendor/composer/ClassLoader.php(322): ComposerAutoloadincludeFile('/chroot/home/af...')
#2 [internal function]: ComposerAutoloadClassLoader->loadClass('Magento\Setup\D...')
#3 [internal function]: spl_autoload_call('Magento\Setup\D...')
#4 /chroot/home/af5d329a/851f14efb2.nxcli.net/html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(134): class_exists('Magento\Setup\D...')
#5 /chroot/home/af5d329a/851f14efb2.nxcli.net/html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(117): MagentoSetupModuleDiCodeReaderClassesScanner->includeClass('Magento\Setup\D...', '/chroot/home/af...')
#6 /chroot/home/af5d329a/851f14efb2. in /chroot/home/af5d329a/851f14efb2.nxcli.net/html/setup/src/Magento/Setup/Di/MagentoDiFactory.php on line 17

I’ve looked inside my MagentoDiFactory.php and I have this:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace MagentoSetupDi;

use InteropContainerContainerInterface;
use LaminasServiceManagerFactoryFactoryInterface;
use MagentoFrameworkAppObjectManager;

/**
 * Instantiates the type via Magento object manager
 */
class MagentoDiFactory implements FactoryInterface
{
    /**
     * @inheritdoc
     */
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        return ObjectManager::getInstance()->get($requestedName);
    }
}

So the supposed missing line is there. And now I don’t know how to proceed and what to do to resolve this.

Our actual composer.json file is as follows:

{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "config": {
        "preferred-install": "dist",
        "sort-packages": true
    },
    "require": {
        "php": "~7.3.0||~7.4.0",
        "absolute_design/absolute-slider": "^2.0.0",
        "colinmollenhour/cache-backend-file": "~1.4.1",
        "colinmollenhour/cache-backend-redis": "^1.11.0",
        "colinmollenhour/credis": "^1.11.1",
        "colinmollenhour/php-redis-session-abstract": "~1.4.0",
        "composer/composer": "^1.9",
        "doctrine/instantiator": "^1.3.1",
        "ebizmarts/sagepaysuite": "~1.4",
        "elasticsearch/elasticsearch": "~7.7.0",
        "guzzlehttp/guzzle": "^6.3.3",
        "guzzlehttp/promises": "^1.4",
        "guzzlehttp/psr7": "^1.8.4",
        "laminas/laminas-captcha": "^2.7.1",
        "laminas/laminas-code": "~3.4.1",
        "laminas/laminas-config": "^2.6.0",
        "laminas/laminas-console": "^2.6.0",
        "laminas/laminas-crypt": "^2.6.0",
        "laminas/laminas-db": "^2.8.2",
        "laminas/laminas-dependency-plugin": "^1.0",
        "laminas/laminas-di": "^2.6.1",
        "laminas/laminas-eventmanager": "^3.0.0",
        "laminas/laminas-feed": "^2.9.0",
        "laminas/laminas-form": "^2.10.0",
        "laminas/laminas-http": "^2.6.0",
        "laminas/laminas-i18n": "^2.7.3",
        "laminas/laminas-json": "^2.6.1",
        "laminas/laminas-log": "^2.9.1",
        "laminas/laminas-mail": "^2.9.0",
        "laminas/laminas-mime": "^2.5.0",
        "laminas/laminas-modulemanager": "^2.7",
        "laminas/laminas-mvc": "~2.7.0",
        "laminas/laminas-serializer": "^2.7.2",
        "laminas/laminas-server": "^2.6.1",
        "laminas/laminas-servicemanager": "^2.7.8",
        "laminas/laminas-session": "^2.7.3",
        "laminas/laminas-soap": "^2.7.0",
        "laminas/laminas-stdlib": "^3.2.1",
        "laminas/laminas-text": "^2.6.0",
        "laminas/laminas-uri": "^2.5.1",
        "laminas/laminas-validator": "^2.6.0",
        "laminas/laminas-view": "~2.11.2",
        "laminas/laminas-zendframework-bridge": "^1.0",
        "magento/composer": "1.6.0",
        "magento/composer-root-update-plugin": "~2",
        "magento/magento-composer-installer": "^0.3.0",
        "magento/product-community-edition": "2.4.1-p1",
        "magento/zendframework1": "~1.14.2",
        "mageplaza/magento-2-english-united-kingdom-language-pack": "@dev",
        "mageplaza/magento-2-seo-extension": "^2.1",
        "mageplaza/module-ajax-layered-navigation": "^1.0",
        "mageplaza/module-delete-orders": "^1.2",
        "mageplaza/module-gdpr": "^1.2",
        "mageplaza/module-sitemap": "^1.0",
        "monolog/monolog": "^1.17",
        "myclabs/deep-copy": "^1.10.1",
        "nikic/php-parser": "^4.4.0",
        "paragonie/sodium_compat": "^1.6",
        "pelago/emogrifier": "^3.1.0",
        "php-amqplib/php-amqplib": "~2.10.0",
        "phpseclib/mcrypt_compat": "1.0.8",
        "phpseclib/phpseclib": "2.0.*",
        "phpspec/prophecy": "^1.11.1",
        "phpunit/php-file-iterator": "~3.0.4",
        "phpunit/php-invoker": "^3.1",
        "phpunit/php-text-template": "^2.0.2",
        "phpunit/php-timer": "^3.0",
        "psr/container": "^1.1.2",
        "psr/http-client": "^1.0",
        "ramsey/uuid": "~3.8.0",
        "sebastian/cli-parser": "^1.0",
        "sebastian/code-unit": "^1.0.5",
        "sebastian/comparator": "^4.0.3",
        "sebastian/diff": "^4.0.2",
        "sebastian/environment": "^5.1.2",
        "sebastian/exporter": "^4.0.2",
        "sebastian/object-enumerator": "^4.0.2",
        "sebastian/resource-operations": "^3.0.2",
        "sebastian/type": "^2.2.1",
        "sebastian/version": "^3.0",
        "symfony/console": "~4.4.0",
        "symfony/event-dispatcher": "~4.4.0",
        "symfony/process": "~4.4.0",
        "tedivm/jshrink": "~1.3.0",
        "th3n3rd/cartesian-product": "^0.3",
        "trustpilot/module-reviews": "^2.6",
        "tubalmartin/cssmin": "4.1.1",
        "webonyx/graphql-php": "^0.13.8",
        "wikimedia/less.php": "~1.8.0"
    },
    "require-dev": {
        "allure-framework/allure-phpunit": "~1.2.0",
        "bamarni/composer-bin-plugin": "^1.4.1",
        "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
        "devster/ubench": "~1.1.0",
        "friendsofphp/php-cs-fixer": "~2.16.0",
        "lusitanian/oauth": "~0.8.10",
        "magento/magento-coding-standard": "*",
        "magento/magento2-functional-testing-framework": "^3.0",
        "pdepend/pdepend": "~2.7.1",
        "phpcompatibility/php-compatibility": "^9.3",
        "phpmd/phpmd": "^2.8.0",
        "phpspec/prophecy-phpunit": "^2.0.1",
        "phpstan/phpstan": ">=0.12.3 <=0.12.23",
        "phpunit/phpunit": "^9",
        "psr/log": "^1.1",
        "sebastian/phpcpd": "~5.0.0",
        "squizlabs/php_codesniffer": "~3.5.4",
        "symfony/finder": "^5.2"
    },
    "conflict": {
        "gene/bluefoot": "*"
    },
    "autoload": {
        "psr-4": {
            "Magento\Framework\": "lib/internal/Magento/Framework/",
            "Magento\Setup\": "setup/src/Magento/Setup/",
            "Magento\": "app/code/Magento/",
            "Zend\Mvc\Controller\": "setup/src/Zend/Mvc/Controller/"
        },
        "psr-0": {
            "": [
                "app/code/",
                "generated/code/"
            ]
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ],
        "exclude-from-classmap": [
            "**/dev/**",
            "**/update/**",
            "**/Test/**"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\Sniffs\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\Tools\": "dev/tools/Magento/Tools/",
            "Magento\Tools\Sanity\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\TestFramework\Inspection\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\TestFramework\Utility\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "version": "2.3.0",
    "minimum-stability": "stable",
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://repo.magento.com/"
        },
        "magento": {
            "type": "composer",
            "url": "https://repo.magento.com"
        },
        "ebizmarts": {
            "type": "composer",
            "url": "https://packages.ebizmarts.com"
        }
    },
    "extra": {
        "magento-force": "override"
    }
}

Any help is appreciated.