作曲家更新后出错
Error after composer update
我最近对我的 Symfony 应用程序 (2.7) 进行了作曲家更新。自从我进行了此更新后,swiftmailer 从 2.4 升级到了 2.5,在执行命令后,控制台向我显示了这个错误:
[运行时异常]
执行“'cache:clear --no-warmup'”命令时出错:
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to replace alias "swiftmailer.mailer.default.transport.real" with actual definition "mail".
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "mail".
我试图删除 "vendor" 中的 swiftmailer 目录,但没有成功。
这是我的 composer.json:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" }
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "7.0"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.7-dev"
}
}
}
预先感谢您的帮助。
这肯定从今天开始就发生了。 (我使用的是 Symfony 2.8.17。)将 Swiftmailer 包恢复到版本 2.4 为我解决了这个问题。
在你的composer.json文件中更改
"symfony/swiftmailer-bundle": "~2.3",
到
"symfony/swiftmailer-bundle": "2.4",
现在做一个 composer 更新,这样你就可以回到 Swiftmailer 包的 2.4 版,一切都会好起来的。看来 2.5 更新中有一个错误。
--
如果您仍然遇到问题,请尝试使用这些命令来完全清除缓存:
rm -rf app/cache/*
rm app/bootstrap.php.cache
同时检查您的 composer.lock 文件以确保 Swiftmailer 包确实已经恢复到 2.4。您应该看到这样的部分:
{
"name": "symfony/swiftmailer-bundle",
"version": "v2.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/swiftmailer-bundle.git",
"reference": "ad751095576ce0c12a284e30e3fff80c91f27225"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/ad751095576ce0c12a284e30e3fff80c91f27225",
"reference": "ad751095576ce0c12a284e30e3fff80c91f27225",
"shasum": ""
},
"require": {
"php": ">=5.3.2",
"swiftmailer/swiftmailer": ">=4.2.0,~5.0",
"symfony/config": "~2.7|~3.0",
"symfony/dependency-injection": "~2.7|~3.0",
"symfony/http-kernel": "~2.7|~3.0"
},
"require-dev": {
"symfony/console": "~2.7|~3.0",
"symfony/framework-bundle": "~2.7|~3.0",
"symfony/phpunit-bridge": "~2.7|~3.0",
"symfony/yaml": "~2.7|~3.0"
},
"suggest": {
"psr/log": "Allows logging"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\Bundle\SwiftmailerBundle\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony SwiftmailerBundle",
"homepage": "http://symfony.com",
"time": "2016-12-20T04:44:33+00:00"
},
您描述的问题很可能不是由错误引起的,而是由于更改了相关依赖项 swiftmailer/swiftmailer
引起的。
You have requested a non-existent service "mail".
表示缺少服务 mail
,Unable to replace alias "swiftmailer.mailer.default.transport.real" with actual definition "mail".
广泛暗示这与 swfitmailer 传输 mail
、class 有关Swift_Transport_MailTransport
使用 insecure php mail()
function。此传输已 弃用,因为
出于安全原因,swiftmailer 版本 5.4.5。
要解决此问题,您需要
- 从传输
mail
切换到当前 swiftmailer 支持的传输,或者
- 将
"swiftmailer/swiftmailer": "<6.0"
添加到您的 composer.json 依赖项中,以防止软件包在 Swift_Transport_MailTransport
消失的地方安装 swiftmailer v6.x。不幸的是,symfony/swiftmailer-bundle
需要 swiftmailer v6.x 从 v3.0.0 开始,所以你需要 require "symfony/swiftmailer-bundle": "^2"
我最近对我的 Symfony 应用程序 (2.7) 进行了作曲家更新。自从我进行了此更新后,swiftmailer 从 2.4 升级到了 2.5,在执行命令后,控制台向我显示了这个错误: [运行时异常]
执行“'cache:clear --no-warmup'”命令时出错:
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to replace alias "swiftmailer.mailer.default.transport.real" with actual definition "mail".
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "mail".
我试图删除 "vendor" 中的 swiftmailer 目录,但没有成功。 这是我的 composer.json:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" }
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "7.0"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.7-dev"
}
}
}
预先感谢您的帮助。
这肯定从今天开始就发生了。 (我使用的是 Symfony 2.8.17。)将 Swiftmailer 包恢复到版本 2.4 为我解决了这个问题。
在你的composer.json文件中更改
"symfony/swiftmailer-bundle": "~2.3",
到
"symfony/swiftmailer-bundle": "2.4",
现在做一个 composer 更新,这样你就可以回到 Swiftmailer 包的 2.4 版,一切都会好起来的。看来 2.5 更新中有一个错误。
--
如果您仍然遇到问题,请尝试使用这些命令来完全清除缓存:
rm -rf app/cache/*
rm app/bootstrap.php.cache
同时检查您的 composer.lock 文件以确保 Swiftmailer 包确实已经恢复到 2.4。您应该看到这样的部分:
{
"name": "symfony/swiftmailer-bundle",
"version": "v2.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/swiftmailer-bundle.git",
"reference": "ad751095576ce0c12a284e30e3fff80c91f27225"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/ad751095576ce0c12a284e30e3fff80c91f27225",
"reference": "ad751095576ce0c12a284e30e3fff80c91f27225",
"shasum": ""
},
"require": {
"php": ">=5.3.2",
"swiftmailer/swiftmailer": ">=4.2.0,~5.0",
"symfony/config": "~2.7|~3.0",
"symfony/dependency-injection": "~2.7|~3.0",
"symfony/http-kernel": "~2.7|~3.0"
},
"require-dev": {
"symfony/console": "~2.7|~3.0",
"symfony/framework-bundle": "~2.7|~3.0",
"symfony/phpunit-bridge": "~2.7|~3.0",
"symfony/yaml": "~2.7|~3.0"
},
"suggest": {
"psr/log": "Allows logging"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\Bundle\SwiftmailerBundle\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony SwiftmailerBundle",
"homepage": "http://symfony.com",
"time": "2016-12-20T04:44:33+00:00"
},
您描述的问题很可能不是由错误引起的,而是由于更改了相关依赖项 swiftmailer/swiftmailer
引起的。
You have requested a non-existent service "mail".
表示缺少服务 mail
,Unable to replace alias "swiftmailer.mailer.default.transport.real" with actual definition "mail".
广泛暗示这与 swfitmailer 传输 mail
、class 有关Swift_Transport_MailTransport
使用 insecure php mail()
function。此传输已 弃用,因为
出于安全原因,swiftmailer 版本 5.4.5。
要解决此问题,您需要
- 从传输
mail
切换到当前 swiftmailer 支持的传输,或者 - 将
"swiftmailer/swiftmailer": "<6.0"
添加到您的 composer.json 依赖项中,以防止软件包在Swift_Transport_MailTransport
消失的地方安装 swiftmailer v6.x。不幸的是,symfony/swiftmailer-bundle
需要 swiftmailer v6.x 从 v3.0.0 开始,所以你需要 require"symfony/swiftmailer-bundle": "^2"