getkirby / cli

Kirby Command Line Interface
MIT License
52 stars 5 forks source link

Does not work in composer <2.2 #7

Closed rasteiner closed 2 years ago

rasteiner commented 2 years ago

But doesn't require "composer-runtime-api": "^2.2".

roman:~/work/project$ kirby
PHP Warning:  require_once(/home/roman/.config/composer/vendor/getkirby/cli/bin/../vendor/autoload.php): Failed to open stream: No such file or directory in /home/roman/.config/composer/vendor/getkirby/cli/bin/kirby on line 24
PHP Fatal error:  Uncaught Error: Failed opening required '/home/roman/.config/composer/vendor/getkirby/cli/bin/../vendor/autoload.php' (include_path='.:/usr/share/php') in /home/roman/.config/composer/vendor/getkirby/cli/bin/kirby:24
Stack trace:
#0 {main}
  thrown in /home/roman/.config/composer/vendor/getkirby/cli/bin/kirby on line 24

The problem points to this line:

require_once $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';`

But $_composer_autoload_path doesn't exist (starts from composer 2.2) and __DIR__ . '/../vendor/autoload.php' assumes that __DIR__ should point to ~/.config/composer/bin, but in reality it is ~/.config/composer/vendor/getkirby/cli/bin

The kirby file in ~/.config/composer/bin is just a symlink. I guess that is also something that changed in composer 2.2

rasteiner commented 2 years ago

can confirm that updating composer (to 2.4 actually) does resolve the problem. So, something like composer-runtime-api": "^2.2" or so requirement could be useful

bastianallgeier commented 2 years ago