cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get Magento 2.4 installed

SOLVED

Cannot get Magento 2.4 installed

Hi guys, for 3 days I have been trying to get Magento working but it always results in errors of what kind. Can someone please guide me through the process?

I am using Ubuntu 18.04 LTS with Nginx 1.14. HTML and Javascript websites are working fine, a sample PHP file with phpinfo() in it works fine too. I am using PHP7.4 FPM by the way.

I just installed Composer so this should be the latest version available on Ubuntu too. The version is 1.6.3.

 

I then used composer to create a new Magento 2.4 project. This work fine untill it gets to:

 

Installing laminas/laminas-dependency-plugin

 

I then receive multiple errors like this:

 

PHP Fatal error: Uncaught Error: Undefined class constant 'PRE_COMMAND_RUN' in /var/www/sharemypatches.com/magento2/vendor/laminas/laminas-dependency-plugin/src/DependencyRewriterPlugin.php:63
Stack trace:
#0 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(378): Laminas\DependencyPlugin\DependencyRewriterPlugin::getSubscribedEvents()
#1 /usr/share/php/Composer/Plugin/PluginManager.php(239): Composer\EventDispatcher\EventDispatcher->addSubscriber()
#2 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin()
#3 /usr/share/php/Composer/Installer/PluginInstaller.php(63): Composer\Plugin\PluginManager->registerPackage()
#4 /usr/share/php/Composer/Installer/InstallationManager.php(173): Composer\Installer\PluginInstaller->install()
#5 /usr/share/php/Composer/Installer/InstallationManager.php(160): Composer\Installer\InstallationManager->install()
#6 /usr/share/php/Composer/Installer.php(588): Composer\Installer\InstallationManager->execute()
#7 /usr/share/php/Composer/Installer.p in /var/www/sharemypatches.com/magento2/vendor/laminas/laminas-dependency-plugin/src/DependencyRewriterPlugin.php on line 63

Fatal error: Uncaught Error: Undefined class constant 'PRE_COMMAND_RUN' in /var/www/sharemypatches.com/magento2/vendor/laminas/laminas-dependency-plugin/src/DependencyRewriterPlugin.php:63
Stack trace:
#0 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(378): Laminas\DependencyPlugin\DependencyRewriterPlugin::getSubscribedEvents()
#1 /usr/share/php/Composer/Plugin/PluginManager.php(239): Composer\EventDispatcher\EventDispatcher->addSubscriber()
#2 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin()
#3 /usr/share/php/Composer/Installer/PluginInstaller.php(63): Composer\Plugin\PluginManager->registerPackage()
#4 /usr/share/php/Composer/Installer/InstallationManager.php(173): Composer\Installer\PluginInstaller->install()
#5 /usr/share/php/Composer/Installer/InstallationManager.php(160): Composer\Installer\InstallationManager->install()
#6 /usr/share/php/Composer/Installer.php(588): Composer\Installer\InstallationManager->execute()
#7 /usr/share/php/Composer/Installer.p in /var/www/sharemypatches.com/magento2/vendor/laminas/laminas-dependency-plugin/src/DependencyRewriterPlugin.php on line 63

Can anyone help me out on this matter please?

 

EDIT:

 

As it seems, for what ever reason my Ubuntu would automatically install an older version of Composer so I manually installed the newest version and that solved the problem(s)!

I did this:

composer -V
sudo apt remove composer
cd /tmp
wget http://getcomposer.org/download/1.10.5/composer.phar

php composer.phar -V
sudo mv composer.phar /usr/bin/composer
sudo chmod 750 /usr/bin/composer
composer -V
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Cannot get Magento 2.4 installed

@infodevbiz4c43 so i think your issue is resolved after upgrading composer because latest composer version is 1.10.xx and you are using 1.6.x.

 

As magento 2.4 require updated composer version and if you are still getting the issue then check the php cli version by using php -v command.

 

Hope it helps!

 

Thanks

View solution in original post

2 REPLIES 2

Re: Cannot get Magento 2.4 installed

@infodevbiz4c43 so i think your issue is resolved after upgrading composer because latest composer version is 1.10.xx and you are using 1.6.x.

 

As magento 2.4 require updated composer version and if you are still getting the issue then check the php cli version by using php -v command.

 

Hope it helps!

 

Thanks

Re: Cannot get Magento 2.4 installed

This worked for me as well.