gpt4 book ai didi

php - Sylius 安装崩溃,因为 "No identifier defined"

转载 作者:行者123 更新时间:2023-12-03 15:53:49 25 4
gpt4 key购买 nike

我正在尝试在 ubuntu 上安装 Sylius 1.8,当我运行时遵循安装指南 composer install我收到以下错误:

Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! // Clearing the cache for the prod environment with debug
!! // false
!!
!!
!! In FileLoader.php line 180:
!!
!! No identifier defined "Sylius\Bundle\ApiBundle\Command\RegisterShopUser". Y
!! ou should add #[\ApiPlatform\Core\Annotation\ApiProperty(identifier: true)]
!! " on the property identifying the resource." in . (which is being imported
!! from "/srv/sylius/vendor/sylius/sylius/src/Sylius/Bundle/ApiBundle/Resource
!! s/config/routing.yml"). Make sure there is a loader supporting the "api_pla
!! tform" type.
!!
!!
!! In IdentifiersExtractor.php line 65:
!!
!! No identifier defined "Sylius\Bundle\ApiBundle\Command\RegisterShopUser". Y
!! ou should add #[\ApiPlatform\Core\Annotation\ApiProperty(identifier: true)]
!! " on the property identifying the resource."
!!
!!
!! cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
!!
!!
Script @auto-scripts was called via post-install-cmd

我也使用过 Sylius docker,但结果是一样的,似乎 Api-Platform 存在问题。

最佳答案

Sylius 使用 Api-Platform,最近发布了 Api-Platform 2.6 版。
从这个版本开始,所有 API 资源——包括自定义 DTO——都需要有一个“标识符”,as other users are finding out .
已经有 exists a PR to fix this to make Sylius compatible with Api-Platform 2.6.0 .
如果您正在安装一个全新的项目,您可以执行以下操作来从头安装 Sylius:

composer create-project sylius/sylius-standard app_dir --no-install --no-scripts 
cd app_dir
composer require api-platform/core:2.5.9 --no-update
composer install
如果您有一个现有项目需要在更新前修复(即使是按照上一步的说明安装的项目),您应该将其添加到 conflict您的 key composer.json :
{
"conflict":  {
"api-platform/core": ">=2.6.0"
}
}
尽管您应该监视 Sylius 的开发以删除此行不再需要。

关于php - Sylius 安装崩溃,因为 "No identifier defined",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65869174/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com