I'm trying to upgrade my Magento installation to the version 2.3.5 using composer but I get the following error:

Uncaught Error: Undefined class constant 'PRE_COMMAND_RUN'

enter image description here

My composer.json is as follows

    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "license": [
    "config": {
        "preferred-install": "dist",
        "sort-packages": true
    "require": {
        "bitexpert/magento2-force-customer-login": "^3.2",
        "magento/product-community-edition": "2.3.5",
        "mageplaza/magento-2-portuguese-language-pack": "dev-master",
        "mageplaza/module-smtp": "^1.2",
        "olegkoval/magento2-regenerate-url-rewrites": "^1.4"
    "require-dev": {
        "friendsofphp/php-cs-fixer": "~2.13.0",
        "lusitanian/oauth": "~0.8.10",
        "magento/magento2-functional-testing-framework": "~2.3.13",
        "pdepend/pdepend": "2.5.2",
        "phpmd/phpmd": "@stable",
        "phpunit/phpunit": "~6.5.0",
        "sebastian/phpcpd": "~3.0.0",
        "squizlabs/php_codesniffer": "3.3.1",
        "allure-framework/allure-phpunit": "~1.2.0"
    "conflict": {
        "gene/bluefoot": "*"
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/",
            "Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"
        "psr-0": {
            "": [
        "files": [
        "exclude-from-classmap": [
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
    "version": "2.3.1",
    "minimum-stability": "stable",
    "repositories": [
            "type": "composer",
            "url": "https://repo.magento.com/"
    "extra": {
        "magento-force": "override"

Can anyone save me please ?

thanks for your time !

3 Answers 3


Try to run the following commands before doing upgrade.

composer clearcache
composer update --vvv --profile

Probably this file is missing or using an old version of a composer - vendor/composer/composer/src/Composer/Plugin/PluginEvents.php

Check above file has or not const PRE_COMMAND_RUN = 'pre-command-run';

May be required to upgrade the composer to the 1.9 or 1.10 to work with laminas libraries.

composer --version  
composer self-update
  • Thank you so much, I just needed to update the composer version and it worked. Again thanks !
    – Joao71
    Commented May 12, 2020 at 13:19
  • @Joao71 glad to help. you can upvote answer so it will help others.
    – sandip
    Commented May 12, 2020 at 13:31
  • 1
    I messed up with my composer installation and your response helped a lot. Basically I ran the following command: composer self-update 1.10.0 and I was able to composer install again (as the composer self-update was going to version 2.0 and above) Commented Mar 2, 2021 at 21:52

Note that the following command:

composer self-update

Will update Composer to the latest version (2.0.7 at the time of this posting), which might bring up other issues if you are trying to install a specific Magento 2 version.

For example, for Magento 2.3.6, you might have issues using the latest Composer version [2.0.7]. I had this issue, and so I had to install the relevant Composer version for the specific install (1.10.13).

So you can update Composer to the specific version you require:

composer self-update 1.10.13

Or, install a specific version of Composer from the start. On Linux:

curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.10.13

Note: You would change the value of --version flag to the specific version you require.


I was updating to 2.3.3 to 2.3.5-p1 got this problem

Composer self-update was not working with my composer version, I use ubuntu(LEMP). Latest version of composer was installed - 1.6.3 I think.

We need this 1.10.17.

    sudo apt remove compsoer
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    sudo php composer-setup.php --version=1.10.17 --install-dir=/usr/bin --filename=composer 

Check version:

composer --version
output: 1.10.17

To be sure remove all vendor and cache:

rm -rf vendor/*
composer clear-cache
composer update

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.