未找到接口 Matcher\RequestMatcherInterface'

Interface Matcher\RequestMatcherInterface' not found

我正在尝试将我的 Symfony 应用程序部署到虚拟主机并收到此错误

 Fatal error: Interface 'Symfony\Component\Routing\Matcher\RequestMatcherInterface' not found in /data/web/virtuals/201283/virtual/www/subdom/dev/vendor/symfony/routing/Matcher/UrlMatcher.php on line 29

我的虚拟主机没有 SSH 访问权限,所以我复制了除 var 和 test 之外的所有文件夹。然后 .env 和 composer.json 到 /subdom/dev (这个子域使用正常的 HTML 索引)

使用php 7.3。 Composer.json

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "gedmo/doctrine-extensions": "^2.4",
        "knplabs/knp-time-bundle": "^1.9",
        "sensio/framework-extra-bundle": "^5.1",
        "stof/doctrine-extensions-bundle": "^1.3",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "4.3.*",
        "symfony/console": "4.3.*",
        "symfony/dotenv": "4.3.*",
        "symfony/expression-language": "4.3.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "4.3.*",
        "symfony/framework-bundle": "4.3.*",
        "symfony/http-client": "4.3.*",
        "symfony/intl": "4.3.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/orm-pack": "*",
        "symfony/process": "4.3.*",
        "symfony/security-bundle": "4.3.*",
        "symfony/serializer-pack": "*",
        "symfony/swiftmailer-bundle": "^3.1",
        "symfony/translation": "4.3.*",
        "symfony/twig-bundle": "4.3.*",
        "symfony/validator": "4.3.*",
        "symfony/web-link": "4.3.*",
        "symfony/yaml": "4.3.*",
        "vich/uploader-bundle": "^1.10"
    },
    "require-dev": {
        "symfony/debug-pack": "*",
        "symfony/maker-bundle": "^1.0",
        "symfony/profiler-pack": "*",
        "symfony/test-pack": "*",
        "symfony/web-server-bundle": "4.3.*"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\Tests\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.3.*"
        }
    }
}

编辑:我试过 echo interface_exists("Symfony\Component\Routing\Matcher\UrlMatcherInterface"); 并且它 returns 1。但是错误仍然存​​在。

我不知道下一步要看哪里。

好的,给读到这里的你。不要与错误争论。如果错误说它没有找到它是真的并修复它。 Filezilla 出现问题,一些文件未正确传输(创建时大小为 0B)。所以我手动复制了它们。

根据您的 composer.json,缺少 "symfony/routing": "4.3.*",,因此 Symfony 路由组件不可用。但是,我不明白为什么 interface_exists returns 在你的情况下是真的...