core icon indicating copy to clipboard operation
core copied to clipboard

Fresh install on Ubuntu 22.04 LTS failing

Open jpedroza2k22 opened this issue 2 years ago • 1 comments

Attempting to install on a new VPS with Ubuntu 22.04 fails at the composer create-project stage.

Details

Question Answer
Relevant Bolt Version current
Install type Composer install
BC Break yes/no
PHP version 8.1.2 and 8.1.12
Web server Apache 2

Reproduction

Every time I run the composer script with the following: composer create-project bolt/project website.com

It performs the initial installation, but when it gets to the post-install scripts:

Bolt\ComposerScripts\ProjectEventHandler::postInstall

! [NOTE] Running composer "post-install-cmd" scripts

I get the following error:

Bug summary

PHP Fatal error: Uncaught TypeError: Symfony\Component\Process\Process::__construct(): Argument #1 ($command) must be of type array, string given, called in /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/Script.php on line 57 and defined in /usr/share/php/Symfony/Component/Process/Process.php:143 Stack trace: #0 /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/Script.php(57): Symfony\Component\Process\Process->__construct() #1 /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/Script.php(39): Bolt\ComposerScripts\Script::runPHP() #2 /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/PostInstallScript.php(13): Bolt\ComposerScripts\Script::runConsole() #3 /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/ProjectEventHandler.php(32): Bolt\ComposerScripts\PostInstallScript::execute() #4 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(389): Bolt\ComposerScripts\ProjectEventHandler::postInstall() #5 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(238): Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() #6 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(119): Composer\EventDispatcher\EventDispatcher->doDispatch() #7 /usr/share/php/Composer/Installer.php(372): Composer\EventDispatcher\EventDispatcher->dispatchScript() #8 /usr/share/php/Composer/Command/CreateProjectCommand.php(271): Composer\Installer->run() #9 /usr/share/php/Composer/Command/CreateProjectCommand.php(168): Composer\Command\CreateProjectCommand->installProject() #10 /usr/share/php/Symfony/Component/Console/Command/Command.php(298): Composer\Command\CreateProjectCommand->execute() #11 /usr/share/php/Symfony/Component/Console/Application.php(1015): Symfony\Component\Console\Command\Command->run() #12 /usr/share/php/Symfony/Component/Console/Application.php(299): Symfony\Component\Console\Application->doRunCommand() #13 /usr/share/php/Composer/Console/Application.php(336): Symfony\Component\Console\Application->doRun() #14 /usr/share/php/Symfony/Component/Console/Application.php(171): Composer\Console\Application->doRun() #15 /usr/share/php/Composer/Console/Application.php(131): Symfony\Component\Console\Application->run() #16 /usr/bin/composer(84): Composer\Console\Application->run() #17 {main} thrown in /usr/share/php/Symfony/Component/Process/Process.php on line 143

Specifics

This is on the command line, and I have tried it with 8.1.2 (the current version with Ubuntu 22.04) and 8.1.12. I get the same error. This is a new VPS that has been up for less than a week at this point. Everything is up to date.

Steps to reproduce

This happens every time I run the installer script.

Expected result

New install

Actual result

PHP Fatal error: Uncaught TypeError: Symfony\Component\Process\Process::__construct(): Argument #1 ($command) must be of type array, string given, called in /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/Script.php on line 57 and defined in /usr/share/php/Symfony/Component/Process/Process.php:143 Stack trace: #0 /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/Script.php(57): Symfony\Component\Process\Process->__construct() #1 /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/Script.php(39): Bolt\ComposerScripts\Script::runPHP() #2 /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/PostInstallScript.php(13): Bolt\ComposerScripts\Script::runConsole() #3 /var/www/virtual-hosts/littleoldwinedrinkers.com/vendor/bolt/core/bin/composer-script/ProjectEventHandler.php(32): Bolt\ComposerScripts\PostInstallScript::execute() #4 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(389): Bolt\ComposerScripts\ProjectEventHandler::postInstall() #5 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(238): Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() #6 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(119): Composer\EventDispatcher\EventDispatcher->doDispatch() #7 /usr/share/php/Composer/Installer.php(372): Composer\EventDispatcher\EventDispatcher->dispatchScript() #8 /usr/share/php/Composer/Command/CreateProjectCommand.php(271): Composer\Installer->run() #9 /usr/share/php/Composer/Command/CreateProjectCommand.php(168): Composer\Command\CreateProjectCommand->installProject() #10 /usr/share/php/Symfony/Component/Console/Command/Command.php(298): Composer\Command\CreateProjectCommand->execute() #11 /usr/share/php/Symfony/Component/Console/Application.php(1015): Symfony\Component\Console\Command\Command->run() #12 /usr/share/php/Symfony/Component/Console/Application.php(299): Symfony\Component\Console\Application->doRunCommand() #13 /usr/share/php/Composer/Console/Application.php(336): Symfony\Component\Console\Application->doRun() #14 /usr/share/php/Symfony/Component/Console/Application.php(171): Composer\Console\Application->doRun() #15 /usr/share/php/Composer/Console/Application.php(131): Symfony\Component\Console\Application->run() #16 /usr/bin/composer(84): Composer\Console\Application->run() #17 {main} thrown in /usr/share/php/Symfony/Component/Process/Process.php on line 143

jpedroza2k22 avatar Nov 21 '22 16:11 jpedroza2k22

Ok, I have found the root cause of the issue. If you are using the default composer from apt in Ubuntu 22.04, with version 2.2.6, then the code in Script.php will fire (it is inside an if block that checks the version of composer). Once I update to a more recent version of composer it worked as expected.

jpedroza2k22 avatar Nov 21 '22 17:11 jpedroza2k22