php 升级symfony版本3后找不到CommandSubscriber,4 - 6.2

q5iwbnjs  于 2023-04-28  发布在  PHP
关注(0)|答案(1)|浏览(114)

我已经从3升级symfony版本。4到6.2,大多数情况下它都能工作,但在连接MongoDB后,我得到了这个错误。
加载“Doctrine\Bundle\MongoDBBundle\APM\StopwatchCommandLogger”时未找到类“MongoDB\Driver\Monitoring\CommandSubscriber”。
Here is the visual of the error
我在哪里犯错误?非常感谢提前。
这是我的 composer 。JSON内容

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "require": {
        "php": ">=8.0",
        "ext-curl": "*",
        "ext-json": "*",
        "ext-mongodb": "*",
        "alcaeus/mongo-php-adapter": "1.2.2",
        "api-platform/core": "^3.2@dev",
        "aws/aws-sdk-php": "^3.209",
        "beberlei/doctrineextensions": "@stable",
        "doctrine/doctrine-fixtures-bundle": "3.4.2",
        "doctrine/doctrine-migrations-bundle": "3.3.x-dev",
        "doctrine/mongodb-odm": "2.6.x-dev",
        "doctrine/mongodb-odm-bundle": "4.6.x-dev",
        "doctrine/orm": "^2.5",
        "friendsofsymfony/rest-bundle": "3.3.*",
        "guzzlehttp/guzzle": "@stable",
        "jms/serializer-bundle": "^3.9",
        "nelmio/api-doc-bundle": "4.8.*",
        "nelmio/cors-bundle": "^2.2",
        "predis/predis": "^1.1",
        "sensio/framework-extra-bundle": "^6.1",
        "sinner/phpseclib-bundle": "dev-master",
        "symfony/dependency-injection": "6.3.x-dev",
        "symfony/dotenv": "v6.2.0",
        "symfony/framework-bundle": "6.2.x-dev",
        "symfony/mailer": "6.2.7",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/security-bundle": "6.3.x-dev",
        "symfony/twig-bundle": "6.3.x-dev",
        "symfony/validator": "6.3.x-dev",
        "twig/extensions": "^1.3",
        "twig/twig": "^1.0||^2.0",
        "willdurand/geocoder-bundle": "@stable"
    },
    "require-dev": {
        "symfony/phpunit-bridge": "^3.0"
    },
    "scripts": {
        "symfony-scripts": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "optimize-autoloader": true,
        "process-timeout":  600,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "allow-plugins": {
            "symfony/flex": true,
            "php-http/discovery": true
        }
    },
    "provide": {
        "ext-mongo": "*",
        "ext-mongodb": "*"
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "branch-alias": {
            "dev-master": "3.4.x-dev"
        }
    }
}

我在谷歌上搜索了3到4个小时,但找不到任何解决方案,所以我想我应该把它贴在堆栈溢出上,这样我就可以从社区得到答案。

hmmo2u0o

hmmo2u0o1#

您是否尝试使用'--ignore-platform-reqs'标志进行编写器安装?我的假设是跳过了'tricism/mongodb-odm'包,因为您没有安装和启用'ext-mongodb' php扩展。
你能试着在没有'--ignore-platform-reqs'标志的情况下运行composer安装吗?

相关问题