【问题标题】:JmsSerializerBundle installation ends with error: Unrecognized option "xml" under "jms_serializer.visitors"JmsSerializerBundle 安装以错误结束:“jms_serializer.visitors”下的无法识别选项“xml”
【发布时间】:2018-11-22 10:47:12
【问题描述】:

当我安装 Symfony 4 框架项目并添加 JmsSerializerBundle 时,出现错误。

复制:

composer create-project symfony/website-skeleton myproject
cd myproject
composer require jms/serializer-bundle

安装以错误结束:

Using version ^3.0 for jms/serializer-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.1.*"
Package operations: 16 installs, 0 updates, 0 removals
  - Installing hoa/exception (1.17.01.16): Loading from cache
  - Installing hoa/event (1.17.01.13): Loading from cache
  - Installing hoa/consistency (1.17.05.02): Loading from cache
  - Installing hoa/visitor (2.17.01.16): Loading from cache
  - Installing hoa/ustring (4.17.01.16): Loading from cache
  - Installing hoa/protocol (1.17.01.14): Loading from cache
  - Installing hoa/zformat (1.17.01.10): Loading from cache
  - Installing hoa/iterator (2.17.01.10): Loading from cache
  - Installing hoa/compiler (3.17.08.08): Loading from cache
  - Installing hoa/regex (1.17.01.13): Loading from cache
  - Installing hoa/math (1.17.05.16): Loading from cache
  - Installing hoa/stream (1.17.02.21): Loading from cache
  - Installing hoa/file (1.17.07.11): Loading from cache
  - Installing jms/metadata (2.0.0): Loading from cache
  - Installing jms/serializer (2.0.0): Loading from cache
  - Installing jms/serializer-bundle (3.0.0): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 1 recipe (f702450e5b1b913f83ea887faacbdb83)
  -  WARNING  jms/serializer-bundle (>=2.0): From github.com/symfony/recipes-contrib:master
    The recipe for this package comes from the "contrib" repository, which is open to community contributions.
    Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/jms/serializer-bundle/2.0

    Do you want to execute this recipe?
    [y] Yes
    [n] No
    [a] Yes for all packages, only for the current installation session
    [p] Yes permanently, never ask again for this project
    (defaults to n): y
  - Configuring jms/serializer-bundle (>=2.0): From github.com/symfony/recipes-contrib:master
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!
!!  In ArrayNode.php line 304:
!!
!!    Unrecognized option "xml" under "jms_serializer.visitors"

在 Windows 10 Powershell 上运行 composer 等。我猜骨架太裸露了,需要依赖,但不应该自动解决吗?

可能是什么原因?我该如何解决?提前感谢您的帮助。

【问题讨论】:

  • Composer 安装了哪个版本的 JMSerializerBundle(2.x 或 3.x)?
  • "jms/serializer-bundle": "^3.0"
  • 当前配方与 JMSSerializerBundle 3 不兼容(有一个待处理的拉取请求,请参阅 github.com/symfony/recipes-contrib/pull/559)。所以现在,您需要手动调整配置。
  • 谢谢。如果您将评论更改为答案,我会接受。

标签: php composer-php symfony4 jmsserializerbundle


【解决方案1】:

当前配方与 JMSSerializerBundle 3 不兼容(有一个待处理的拉取请求,请参阅 https://github.com/symfony/recipes-contrib/pull/559)。所以现在,您需要手动调整配置。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-06-26
  • 1970-01-01
  • 2017-11-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多