作曲家安装/更新触发器类 Doctrine\Common\Cache\ArrayCache 不存在
Posted
技术标签:
【中文标题】作曲家安装/更新触发器类 Doctrine\\Common\\Cache\\ArrayCache 不存在【英文标题】:composer install/update trigger Class Doctrine\Common\Cache\ArrayCache does not exist作曲家安装/更新触发器类 Doctrine\Common\Cache\ArrayCache 不存在 【发布时间】:2021-10-09 14:35:43 【问题描述】:我正在使用 symfony5,想在今天早些时候部署,但在使用 composer install
或 composer update
加载供应商时出现以下错误失败:
根据这个问题'Class Doctrine\Common\Cache\ArrayCache does not exist' when installing a symfony project 对某些人有效,错误可能来自我的教义版本,但由于我在过去几天没有更新它,所以我不明白它怎么可能
这是我的composer.json
,以防万一:
"type": "project",
"license": "MIT",
"require":
"php": ">=7.4",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"ext-zip": "*",
"api-platform/core": "^2.5",
"beberlei/doctrineextensions": "^1.3",
"composer/package-versions-deprecated": "^1.11",
"digitick/sepa-xml": "^2.1",
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"gesdinet/jwt-refresh-token-bundle": "^0.9.1",
"giggsey/libphonenumber-for-php": "^8.12",
"guzzlehttp/guzzle": "^7.0",
"h4cc/wkhtmltopdf-amd64": "^0.12.4",
"jsor/doctrine-postgis": "^1.7",
"knplabs/knp-snappy-bundle": "^1.8",
"lcobucci/jwt": "^3.3",
"lexik/jwt-authentication-bundle": "^2.8",
"nelmio/cors-bundle": "^2.1",
"phpdocumentor/reflection-docblock": "^5.2",
"ramsey/uuid": "^4.1",
"sensio/framework-extra-bundle": "^5.6",
"stof/doctrine-extensions-bundle": "^1.5",
"stripe/stripe-php": "^7.62",
"symfony/amqp-messenger": "5.1.*",
"symfony/asset": "5.1.*",
"symfony/console": "5.1.*",
"symfony/dependency-injection": "5.1.*",
"symfony/dotenv": "5.1.*",
"symfony/expression-language": "5.1.*",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "5.1.*",
"symfony/http-client": "5.1.*",
"symfony/mailer": "5.1.*",
"symfony/mercure-bundle": "^0.2.5",
"symfony/messenger": "5.1.*",
"symfony/monolog-bundle": "^3.6",
"symfony/property-access": "5.1.*",
"symfony/property-info": "5.1.*",
"symfony/security-bundle": "5.1.*",
"symfony/serializer": "5.1.*",
"symfony/translation": "5.1.*",
"symfony/twig-bundle": "5.1.*",
"symfony/validator": "5.1.*",
"symfony/yaml": "5.1.*",
"twig/cssinliner-extra": "^3.1",
"twig/extra-bundle": "^2.12|^3.0",
"twig/inky-extra": "^3.1",
"twig/twig": "^2.12|^3.0",
"twilio/sdk": "^6.16",
"vich/uploader-bundle": "^1.16"
,
"require-dev":
"api-platform/schema-generator": "^2.2",
"dama/doctrine-test-bundle": "^6.4",
"doctrine/doctrine-fixtures-bundle": "^3.3",
"fzaninotto/faker": "^1.9",
"justinrainbow/json-schema": "^5.2",
"symfony/browser-kit": "^5.1",
"symfony/css-selector": "^5.1",
"symfony/debug-bundle": "^5.1",
"symfony/maker-bundle": "^1.21",
"symfony/phpunit-bridge": "^5.1",
"symfony/stopwatch": "^5.1",
"symfony/var-dumper": "^5.1",
"symfony/web-profiler-bundle": "^5.1"
,
"config":
"optimize-autoloader": true,
"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-php74": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php72": "*",
"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": "5.1.*"
有谁知道这个错误可能来自哪里,或者在我被困在这个问题上时能想到可能的解决方案
谢谢
更新
composer install -v
的结果
【问题讨论】:
感谢您的回复!我已经更新了我的完整composer.json
我还尝试了其他两种解决方案,导致与我的帖子中相同的错误
我已经用composer install -v
的结果更新了我的帖子,我正在运行开发环境
好的,我已经删除了var/cache/dev
并重新安装了,但结果还是一样
您尝试过什么解决问题的方法?你被困在哪里了?自上一个工作版本以来发生了什么变化?也许已经更新了任何软件包,因为 ArrayCache
已在 doctrine/cache
v2 中删除?
问题是api-platform/core: ^2.5
与doctrine/cache: ^2.0
不兼容造成的,可以拨打composer remove api-platform/core
确认。 Symfony 5.2 需要 api-platform/core: ^2.6
或需要 doctrine/cache: ^1.12
【参考方案1】:
正如您在 doctrine/cache
的 issue posted in the issue tracker 中看到的那样,该类已在该软件包的 v1 中被弃用,并在 v2 中被删除。
如果您仍想使用该类,请运行 composer require doctrine/cache "^1.12"
从 v1 分支安装该软件包的版本。
从长远来看,您应该检查您的应用程序在哪里需要该类并寻找替代方案。如果您需要这方面的帮助,请分享更多详细信息。
【讨论】:
这是迄今为止确保与 Symfony 5.1 兼容的最简单的解决方案,因为它不再受支持并且symfony/framework-bundle
使用Doctrine\Common\Cache\ArrayCache
作为service definition。以上是关于作曲家安装/更新触发器类 Doctrine\Common\Cache\ArrayCache 不存在的主要内容,如果未能解决你的问题,请参考以下文章