studio icon indicating copy to clipboard operation
studio copied to clipboard

Installation fails with Composer 2 in some cases

Open emodric opened this issue 4 years ago • 0 comments

Hi,

here are a couple of cases where install fails with Composer 2, while install Composer 1 works fine (doesn't matter if Studio symlinks the repo or not). To test, you can use this repo as a reproducer:

https://github.com/emodric/studio-composer2

To get it up and running:

git clone https://github.com/emodric/studio-composer2
cd studio-composer2
mv case1/repos/polyfill/..git case1/repos/polyfill/.git
mv case2/repos/polyfill/..git case2/repos/polyfill/.git
mv case3/repos/polyfill/..git case3/repos/polyfill/.git

Case 1: Version in composer.json (~1.20.0) and local version (1.21.0) missmatch. Composer 1 would just install 1.20.0 from Packagist and be done with it. Composer 2 fails the install.

~/www/studio/case1 $ composer install

[Studio] Loading path repos/*
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 9 installs, 0 updates, 0 removals
  - Installing symfony/polyfill (v1.20.0): Downloading (100%)         
  - Installing symfony/process (v5.2.1): Loading from cache
  - Installing symfony/filesystem (v5.2.1): Loading from cache
  - Installing symfony/string (v5.2.1): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/service-contracts (v2.2.0): Loading from cache
  - Installing symfony/console (v5.2.1): Loading from cache
  - Installing franzl/studio (0.15.0): Loading from cache
  - Installing symfony/intl (v5.2.1): Loading from cache
Writing lock file
Generating autoload files
8 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Symfony recipes are disabled: "symfony/flex" not found in the root composer.json
~/www/studio/case1 $ composer2 install

No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
[Studio] Loading path repos/*
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires symfony/polyfill ~1.20.0, it is satisfiable by symfony/polyfill[v1.20.0] from composer repo (https://repo.packagist.org) but symfony/polyfill[dev-main, 1.21.x-dev (alias of dev-main)] from path repo (repos/*) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.

Case 2: Version in composer.json (~1.21.0) and local version (1.21.0) match. This is using a stable requirement. Composer 1 would just install 1.21.0 from Packagist and be done with it. Composer 2 fails the install.

~/www/studio/case2 $ composer install

[Studio] Loading path repos/*
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 8 installs, 0 updates, 0 removals
  - Installing symfony/polyfill (v1.21.0): Downloading (100%)         
  - Installing symfony/process (v5.2.1): Loading from cache
  - Installing symfony/filesystem (v5.2.1): Loading from cache
  - Installing symfony/string (v5.2.1): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/service-contracts (v2.2.0): Loading from cache
  - Installing symfony/console (v5.2.1): Loading from cache
  - Installing franzl/studio (0.15.0): Loading from cache
Writing lock file
Generating autoload files
7 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Symfony recipes are disabled: "symfony/flex" not found in the root composer.json
~/www/studio/case2 $ composer2 install

No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
[Studio] Loading path repos/*
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires symfony/polyfill ~1.21.0, it is satisfiable by symfony/polyfill[v1.21.0] from composer repo (https://repo.packagist.org) but symfony/polyfill[dev-main, 1.21.x-dev (alias of dev-main)] from path repo (repos/*) has higher repository priority. The packages with higher priority do not match your minimum-stability and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.

Case 3: Version in composer.json (~1.21.0@dev) and local version (1.21.0) match. This is using a dev requirement. Composer 1 and Composer 2 work OK and symlink the package, so no need for example output.

emodric avatar Dec 18 '20 15:12 emodric