Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install with composer 2.5.0 not work #168

Closed
DevertNet opened this issue Dec 20, 2022 · 10 comments
Closed

Install with composer 2.5.0 not work #168

DevertNet opened this issue Dec 20, 2022 · 10 comments

Comments

@DevertNet
Copy link

PHP Version

8.1

Shopware Version

6.4.18.0

Expected behaviour

A fresh clone of shopware/production and a composer install works without a problem.

Actual behaviour

composer install run into the following error:

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
Script @composer install --working-dir vendor/shopware/recovery --no-interaction --no-scripts handling the post-install-cmd event returned with error code 4
Error: Process completed with exit code 4.

The problem is that composer 2.5.0 (20.12.2022) changed the following:
Added hard failure when installing from a lock file which does not satisfy the composer.json requirements
https://github.com/composer/composer/blob/main/CHANGELOG.md

It looks like that the composer.json und composer.lock file of shopware/recovery does not match.

How to reproduce

  1. Clone shopware/production and switch to version 6.4.18.0
  2. Fire composer install
@DevertNet
Copy link
Author

As workaround you can change your composer version with this command to the last working version:
composer self-update 2.4.4
I need this workaround in my CI :D

@shyim shyim pinned this issue Dec 20, 2022
@shyim
Copy link
Member

shyim commented Dec 20, 2022

Hey,

We can't really fix it for the older versions. But we will fix it for the next minor release.

For now you have three options to fix this:

Removing shopware/recovery (Recommended)

The recovery package contains only the Updater logic for the Web Updater. This is not required for composer based updates.

Update your composer.json

"scripts": {
        "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"
    },

Update to Flex Template

The Flex template does not contain the Recovery anymore. https://www.shopware.com/en/news/shopware-goes-symfony-flex/

Run composer update inside that folder

By calling update, you generate a newer lock file and then finally can run it.

composer update -d vendor/shopware/recovery/Common/

@Schrank
Copy link
Contributor

Schrank commented Dec 20, 2022

Fourth Alternative: stay on composer 2.4.4

@aragon999
Copy link
Contributor

aragon999 commented Dec 21, 2022

The obvious fix would be to release a new patch version for each affected minor version.

@philipschikora
Copy link

Is there any update on this issue?

@shyim
Copy link
Member

shyim commented Feb 20, 2023

I will close this as in newer versions this has been fixed

@shyim shyim closed this as completed Feb 20, 2023
@VPysarenko-nme
Copy link

I've installed 6.4.20.0 and I have the exact same problem

@philipschikora
Copy link

the fix above works for now

@mikewink
Copy link

mikewink commented Jun 4, 2023

@shyim thank you for the fix!

Can/Should I update to the new Flex template while using Shopware 6.4.x or will that be done for me with the upgrade to 6.5.x? And if I should update, where do I find more information about the process?

Thank you

@shyim
Copy link
Member

shyim commented Jun 4, 2023

The auto updater will migrate to flex. You can use the new installer to migrate to >= 6.4.18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants