如何修复 Drupal/mystore/vendor/composer/composer/src/Composer/DependencyResolver/Pool.php:61 中的非法偏移类型

How to fix Illegal offset type in Drupal/mystore/vendor/composer/composer/src/Composer/DependencyResolver/Pool.php:61

我是 Drupal 的新手,正在尝试使用 composer 安装它。

我的作曲家安装很顺利,但现在,每次我尝试做某事时,我都会在控制台中收到此错误:

PHP Fatal error:  Uncaught TypeError: Illegal offset type in /srv/http/Drupal/mystore/vendor/composer/composer/src/Composer/DependencyResolver/Pool.php:61
Stack trace:
#0 phar:///usr/bin/composer/src/Composer/DependencyResolver/PoolBuilder.php(229): Composer\DependencyResolver\Pool->__construct()
#1 phar:///usr/bin/composer/src/Composer/Repository/RepositorySet.php(227): Composer\DependencyResolver\PoolBuilder->buildPool()
#2 phar:///usr/bin/composer/src/Composer/Installer.php(399): Composer\Repository\RepositorySet->createPool()
#3 phar:///usr/bin/composer/src/Composer/Installer.php(247): Composer\Installer->doUpdate()
#4 phar:///usr/bin/composer/src/Composer/Command/RequireCommand.php(323): Composer\Installer->run()
#5 phar:///usr/bin/composer/src/Composer/Command/RequireCommand.php(243): Composer\Command\RequireCommand->doUpdate()
#6 phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php(245): Composer\Command\RequireCommand->execute()
#7 phar:///usr/bin/composer/vendor/symfony/console/Application.php(835): Symfony\Component\Console\Command\Command->run()
#8 phar:///usr/bin/composer/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand()
#9 phar:///usr/bin/composer/src/Composer/Console/Application.php(310): Symfony\Component\Console\Application->doRun()
#10 phar:///usr/bin/composer/vendor/symfony/console/Application.php(117): Composer\Console\Application->doRun()
#11 phar:///usr/bin/composer/src/Composer/Console/Application.php(122): Symfony\Component\Console\Application->run()
#12 phar:///usr/bin/composer/bin/composer(63): Composer\Console\Application->run()
#13 /usr/bin/composer(24): require('phar:///usr/bin...')
#14 {main}
  thrown in /srv/http/Drupal/mystore/vendor/composer/composer/src/Composer/DependencyResolver/Pool.php on line 61

Fatal error: Uncaught TypeError: Illegal offset type in /srv/http/Drupal/mystore/vendor/composer/composer/src/Composer/DependencyResolver/Pool.php:61
Stack trace:
#0 phar:///usr/bin/composer/src/Composer/DependencyResolver/PoolBuilder.php(229): Composer\DependencyResolver\Pool->__construct()
#1 phar:///usr/bin/composer/src/Composer/Repository/RepositorySet.php(227): Composer\DependencyResolver\PoolBuilder->buildPool()
#2 phar:///usr/bin/composer/src/Composer/Installer.php(399): Composer\Repository\RepositorySet->createPool()
#3 phar:///usr/bin/composer/src/Composer/Installer.php(247): Composer\Installer->doUpdate()
#4 phar:///usr/bin/composer/src/Composer/Command/RequireCommand.php(323): Composer\Installer->run()
#5 phar:///usr/bin/composer/src/Composer/Command/RequireCommand.php(243): Composer\Command\RequireCommand->doUpdate()
#6 phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php(245): Composer\Command\RequireCommand->execute()
#7 phar:///usr/bin/composer/vendor/symfony/console/Application.php(835): Symfony\Component\Console\Command\Command->run()
#8 phar:///usr/bin/composer/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand()
#9 phar:///usr/bin/composer/src/Composer/Console/Application.php(310): Symfony\Component\Console\Application->doRun()
#10 phar:///usr/bin/composer/vendor/symfony/console/Application.php(117): Composer\Console\Application->doRun()
#11 phar:///usr/bin/composer/src/Composer/Console/Application.php(122): Symfony\Component\Console\Application->run()
#12 phar:///usr/bin/composer/bin/composer(63): Composer\Console\Application->run()
#13 /usr/bin/composer(24): require('phar:///usr/bin...')
#14 {main}
  thrown in /srv/http/Drupal/mystore/vendor/composer/composer/src/Composer/DependencyResolver/Pool.php on line 61

我感觉这可能是兼容性问题?

这是我的 composer.json :

{
    "name": "drupalcommerce/project-base",
    "description": "Commerce 2.x project template",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": {
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "commerce_base": {
            "type": "vcs",
            "url": "https://github.com/drupalcommerce/commerce_base"
        },
        "asset-packagist": {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    },
    "config": {
        "bin-dir": "bin",
        "sort-packages": true,
        "platform": {
            "php": "7.1.3"
        }
    },
    "require": {
        "php": ">=7.1",
        "ext-curl": "*",
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6.5",
        "drupal/commerce": "^2.24",
        "drupal/core": "^8.9.0",
        "drupal/core-composer-scaffold": "^8.9.0",
        "drupal/search_api": "^1.0",
        "drupal/swiftmailer": "^2.0",
        "drupal/token": "^1.0",
        "drupalcommerce/commerce_base": "dev-8.x-1.x",
        "drush/drush": "^9.7.1 | ^10.0.0",
        "oomphinc/composer-installers-extender": "^2.0",
        "webflo/drupal-finder": "^1.0.0",
        "webmozart/path-util": "^2.3"
    },
    "require-dev": {
        "drupal/core-dev": "^8.9.0",
        "zaporylie/composer-drupal-optimizations": "^1.1"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ]
    },
    "scripts": {
        "drupal-scaffold": "DrupalComposer\DrupalScaffold\Plugin::scaffold",
        "pre-install-cmd": [
            "DrupalProject\composer\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\composer\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\composer\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\composer\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-types": [
            "bower-asset",
            "npm-asset"
        ],
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library",
                "type:bower-asset",
                "type:npm-asset"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ]
        }
    }
}

我完全不知道如何解决这个问题,有人可以帮我吗?

好的,这是我的错误。我做了 composer selfupdate 这一切都结束了。 :)