# Composer Installation schlägt fehl

**URL:** <https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181>\
**Category:** Shopware 6 (German)\
**Created:** [24. Januar 2023 um 17:25 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181 "2023-01-24T17:25:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![e4u](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@e4u](https://forum.shopware.com/u/e4u)\
**Post date:** [24. Januar 2023 um 17:25 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/1 "2023-01-24T17:25:58Z")

</div>

Hallo zusammen,

wir versuchten die elasticsearch komponente über den composer zu installieren und erhalten folgende Fehlermeldung:

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 [Resolving merge conflicts - Composer](https://getcomposer.org/doc/articles/resolving-merge-conflicts.md)  
and prefer using the „require“ command over editing the composer.json file directly [Command-line interface / Commands - Composer](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

auch ein composer update funktioniert nicht.  
hatte jemand schon einmal das problem?

---

<div class="post-metadata">

**Author:** ![marco.steinhaeuser](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/marco.steinhaeuser/32/14512_2.png) [@marco.steinhaeuser](https://forum.shopware.com/u/marco.steinhaeuser)\
**Post date:** [24. Januar 2023 um 19:20 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/2 "2023-01-24T19:20:03Z")

</div>

Mach mal folgendes bitte:

> composer self-update

danach

> composer update

Wenn in der composer.json ebenfalls „~9.5.17“ steht, sicher Dir bitte mal die composer.lock weg, änder manuell in der composer.json auf „9.5.2“, um dann nochmal composer update abzufeuern.

---

<div class="post-metadata">

**Author:** ![e4u](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@e4u](https://forum.shopware.com/u/e4u)\
**Post date:** [24. Januar 2023 um 19:59 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/3 "2023-01-24T19:59:16Z")

</div>

Hallo Marco,

nachdem das selfupdate auch nicht funktioniert hat, hab ich den composer entfernt und neu installiert.  
hab dann das self update ausführen können, wobei die neueste version bereits installiert war.

hab dann `composer update` ausgeführt. Selbes Ergebnis. in der json den wert geändert, wie vorgeschlagen … Selbes Ergebnis … in der .lock den Wert geändert. Selbes Ergebnis.

```auto
composer update
> [! -f vendor/autoload.php] || $PHP_BINARY bin/console system:update:prepare
Run Update preparations
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Package symfony/inflector is abandoned, you should avoid using it. Use EnglishInflector from the String component instead.
Package true/punycode is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
131 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
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

```

das ist die komplette Meldung beim ausführen des Updates

Shop-Version: 6.4.18.1

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [24. Januar 2023 um 22:04 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/4 "2023-01-24T22:04:09Z")

</div>

> [@e4u](#):
>
> `phpunit`

Wenn es daran scheitert, dann kannst du das constraint sicherlich auf 9.5.2 setzen. phpunit sollte im produktiv System nicht verwendet werden.

---

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.shopware.com/u/abdullah)\
**Post date:** [24. Januar 2023 um 22:06 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/5 "2023-01-24T22:06:55Z")

</div>

Welche Composer Version verwendest du?

Bin mir nicht mehr sicher, aber letztens hatte auch jemand ein Composer Problem hier im Forum.  
Bin der Meinung, dass ein Downgrade der Composer Version vorgenommen wurde und anschließend funktionierte wieder alles.

Edit: hier der Beitrag

> [@Deployment-Fehler "Required package "shopware/core" is not present in the lock file."](https://forum.shopware.com/t/deployment-fehler-required-package-shopware-core-is-not-present-in-the-lock-file/97726):
>
> Hallo wir haben über GitHub-Actions ein automatisches Deployment eingerichtet. Das hat 100 Mal auch korrekt funktioniert, von einem Commit zum nächsten schlägt dieses fehl. Folgende deployment.yml: name: Deployment to Testserver on: pull\_request: branches: - main types: [closed] jobs: build: name: "Build Shopware" if: github.event.pull\_request.merged == true runs-on: ubuntu-latest steps: - name: "Setup PHP" uses: shivammathur/setup-php@v2 …

---

<div class="post-metadata">

**Author:** ![ph91](https://avatars.discourse-cdn.com/v4/letter/p/fbc32d/32.png) [@ph91](https://forum.shopware.com/u/ph91)\
**Post date:** [25. Januar 2023 um 18:22 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/6 "2023-01-25T18:22:53Z")

</div>

Ich habe seit kurzem genau das gleiche Problem mit Shopware 6.4.18.1 und ich verwende Composer 2.5.1.  
Das Problem trat nicht durch ein composer self-update auf. Ich habe nun auch verschiedenste Wege versucht und konnte das Problem bisher nicht lösen.

---

<div class="post-metadata">

**Author:** ![e4u](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@e4u](https://forum.shopware.com/u/e4u)\
**Post date:** [25. Januar 2023 um 19:16 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/7 "2023-01-25T19:16:37Z")

</div>

Hallo zusammen,

die Problemlösung, zumindest bei uns, war ein downgrade der composer version von 2.5.1 auf 2.4.0  
die aktuelle composer version einfach löschen. Anschliessend folgenden code ausführen:

```auto
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup --install-dir=/usr/bin --filename=composer --version=2.4.0

```

Anstatt 2.4.0 kann auch eine andere gewählt werden.  
Die verfügbaren versionen findet ihr hier:

> **[Composer](https://getcomposer.org/download/)**
>
> A Dependency Manager for PHP

---

<div class="post-metadata">

**Author:** ![marco.steinhaeuser](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/marco.steinhaeuser/32/14512_2.png) [@marco.steinhaeuser](https://forum.shopware.com/u/marco.steinhaeuser)\
**Post date:** [26. Januar 2023 um 18:23 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/8 "2023-01-26T18:23:30Z")

</div>

Danke für die Rückmeldung!

---

<div class="post-metadata">

**Author:** ![marco.steinhaeuser](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/marco.steinhaeuser/32/14512_2.png) [@marco.steinhaeuser](https://forum.shopware.com/u/marco.steinhaeuser)\
**Post date:** [26. Januar 2023 um 21:06 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/9 "2023-01-26T21:06:44Z")

</div>

Oh ich sehe grad - hier kam das Thema schon einmal auf:

> <https://github.com/shopware/production/issues/168>
>
> \### 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\`

---

<div class="post-metadata">

**Author:** ![ph91](https://avatars.discourse-cdn.com/v4/letter/p/fbc32d/32.png) [@ph91](https://forum.shopware.com/u/ph91)\
**Post date:** [27. Januar 2023 um 19:57 UTC](https://forum.shopware.com/t/composer-installation-schlaegt-fehl/98181/10 "2023-01-27T19:57:26Z")

</div>

composer self-update 2.4.4 hat bei mir das Problem behoben. Wäre super, wenn Shopware das auch für Composer 2.5+ kompatibel macht.
