无法安装 Magento 2.4

SirLouen

普通会员
管理成员
外贸币
0.00G
嗨,大家好,为了让Magento正常我搞了3天了,它总是会出现各种各样的错误。有人可以指导我吗?
我正在使用带有 Nginx 1.14 的 Ubuntu 18.04 LTS。HTML 和 Javascript 网站运行良好,带有 phpinfo() 的示例 PHP 文件也运行良好。顺便说一下,我正在使用 PHP7.4 FPM。

我刚刚安装了 Composer,所以这也应该是 Ubuntu 上可用的最新版本。版本是 1.6.3。

然后我使用 composer 创建了一个新的 Magento 2.4 项目。这个工作正常,直到它出现:

安装 laminas/laminas-dependency-plugin 出现:

PHP:
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

有人都可以帮我解决这个问题吗?
 

MisterF

资源组
资源管理组
外贸币
1,006.60G
所以我认为升级composer 您的问题已解决,因为最新的composer版本是 1.10.xx 而您使用的是 1.6.x。
由于 magento 2.4 需要更新的 Composer 版本,如果您仍然遇到问题,请使用 php -v 命令检查 php cli 版本。


希望能帮助到你!

代码:
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
 
顶部