Composer Init command gives TypeError on Author/Name (Composer 2.3.7)

Viewed 79

Hi guys i ve a little misunderstanding with Composer. I get error wrote 'Composer Init' in vsc Terminal, though composer is installed.

I checked composer -V in cmd and it tells that i have 'version 2.3.7' installed.

But in Visual Studio Code terminal I write 'composer init' to generate composer.json file and get this kind of error:

 In InitCommand.php line 465:
                                                                                                                                                                           
    [TypeError]                                                                                                                                                                  
    Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type 
    string, 
    null given, called in phar://C:/ProgramData/ComposerSetup/bin/composer.ph   
    ar/src/Composer/Command/InitCommand.php on line 345                                                                                                                          
                                                                                                                                                                           
1 Answers

This error can be caused in Composer 2.3.7 when being asked for the authors name in composer init and then entering nothing while not having the git author or the composer default author in the environment.

Either enter n or no to leave the username empty or enter a non-empty author name.

This is patched in Composer version 2.3.8 (Release date: 1st of July 2022).

The type error is a regression. Composer 2.2.x / 1.10.x are not affected.

Related