php Composer-Shopware项目中的“bug”

xzlaal3s  于 2023-05-21  发布在  PHP
关注(0)|答案(1)|浏览(154)

我在我的商店软件项目中遇到了 composer 的问题。在编写器安装或编写器更新后,我收到以下错误:

Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
- Required package "shopware/core" is not present in the lock file.
- Required (in require-dev) package "phpunit/phpunit" is in the lock file as "9.5.2" but that does not satisfy your constraint "~9.5.17".
This usually happens when composer files are incorrectly merged or the composer.json file is manually edited.
Read more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md
and prefer using the "require" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require-r
Script @composer install --working-dir vendor/shopware/recovery --no-interaction --no-scripts handling the post-update-cmd event returned with error code 4

删除composer.lock没有帮助。有人知道发生什么事了吗?
“composer update”->应该可以正常工作而不会出错

nafvub8i

nafvub8i1#

对我来说,这是一种变通方法,将 composer 版本从最新的composer self-update 2.4.4更改为稍旧的composer self-update 2.4.4,如DevertNet所建议的(文章:https://github.com/shopware/production/issues/168)。但是shyim的回答详细解释了如何从源头上解决问题(下面的解决方案)。
1.更新composer.json文件(删除带“-”的行)

"pre-install-cmd": [
            "[ ! -f vendor/autoload.php ] || $PHP_BINARY bin/console system:update:prepare"
        ],
        "pre-update-cmd": [
            "[ ! -f vendor/autoload.php ] || $PHP_BINARY bin/console system:update:prepare"
        ],
        "post-install-cmd": [
-           "@composer install --working-dir vendor/shopware/recovery --no-interaction --no-scripts",
-           "@composer install --working-dir=vendor/shopware/recovery/Common --no-interaction --optimize-autoloader --no-suggest",
            "[ ! -f vendor/autoload.php ] || $PHP_BINARY bin/console system:update:finish"
        ],
        "post-update-cmd": [
-           "@composer install --working-dir vendor/shopware/recovery --no-interaction --no-scripts",
-           "@composer install --working-dir=vendor/shopware/recovery/Common --no-interaction --optimize-autoloader --no-suggest",
            "[ ! -f vendor/autoload.php ] || $PHP_BINARY bin/console system:update:finish"
        ]
    }
"require": {
        "php": "^7.4.3 || ^8.0",
        "composer-runtime-api": "^2.0",
        "shopware/administration": "~v6.4.0",
        "shopware/core": "~v6.4.0",
        "shopware/elasticsearch": "~v6.4.0",
-       "shopware/recovery": "~v6.4.0",
        "shopware/storefront": "~v6.4.0"
    },

1.更新至Flex模板-Flex模板不再包含恢复。https://www.shopware.com/en/news/shopware-goes-symfony-flex/
1.在该文件夹中运行composer update

  • 通过调用update,您可以生成一个更新的锁文件,然后最终可以运行它。composer update -d vendor/shopware/recovery/Common/

相关问题