【问题标题】:Symfony - (1/1) InvalidConfigurationException - Unrecognized option "mailer" under "framework"Symfony - (1/1) InvalidConfigurationException - “框架”下无法识别的选项“邮件程序”
【发布时间】:2021-05-03 05:02:39
【问题描述】:

我是 Symfony 的新手,在尝试在本地运行项目时,我在实习期间遇到了这个问题:

(1/1) InvalidConfigurationException        
 In ArrayNode.php line 331:                                                                                                                                                                                                                                     
      Unrecognized option "mailer" under "framework". Available options are "annotations", "assets", "cache", [...], "workflows".

我正在运行 PHP 7.4 和 Symfony 4,从另一个开发者那里改编了一个 symfony 项目。

在我的 .env 文件中,我得到了 swiftmailer 包,我相信 mailer 是另一种使用的邮件包..?

我尝试了以下请求:

 composer require symfony/mailer

得到了这个:

    The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
Using version ^5.2 for symfony/mailer
./composer.json has been updated
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
Running composer update symfony/mailer
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/mailer[v5.2.0, ..., v5.2.2] require symfony/event-dispatcher ^4.4|^5.0 -> found symfony/event-dispatcher[v4.4.0, ..., v4.4.19, v5.0.0, ..., v5.2.2] but the package is fixed to v4.2.8 (lock file version) by a partial up
date and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires symfony/mailer ^5.2 -> satisfiable by symfony/mailer[v5.2.0, v5.2.1, v5.2.2].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

感谢您的帮助!

【问题讨论】:

    标签: php symfony frameworks mailer


    【解决方案1】:

    如果您正在启动另一个开发者的项目,您可能不需要任何composer require。您所要做的就是在项目目录中运行composer install 以获取与之前开发人员相同的所有包。

    【讨论】:

    • 我尝试运行 composer install 但它失败了。然后有人建议我运行作曲家更新,但它也失败了(无法从 packagist.org (HHTP/2 504) 下载一些文件
    • @Jerome59 你能提供命令的输出吗?
    • 作曲家安装结果:codeshare.io/G8RBzE
    • 您是否尝试过运行composer update,正如此日志所建议的那样?
    • 嗨,是的,我试过了,我也遇到了错误。我再次从一个干净的项目重新启动,并按照您的建议通过 composer install 构建了供应商,它终于奏效了!因为我第一次没有那样做。
    猜你喜欢
    • 2015-04-19
    • 1970-01-01
    • 2018-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多