cancel
Showing results for 
Search instead for 
Did you mean: 

Update Magento 2.3.4 to 2.4.x version, require.composer-root-update-plugin is invalid...

SOLVED

Update Magento 2.3.4 to 2.4.x version, require.composer-root-update-plugin is invalid...

Hello,

I'm experiencing an issue while executing commands on a Plesk server via plesk ssh terminal, in a magento site (/httpdocs).

 

I try to update magento 2.3.4 to 2.4.x version.

Commands:

composer require magento/composer-root-update-plugin=~1.0 --no-update
composer update
composer validate

In all cases, I'm getting the following error message:

In RootPackageLoader.php line 160:
require.composer-root-update-plugin is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -
, . or _. The complete name should match "^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$".

I have checked the composer.json file and made sure that the syntax of the "require.composer-root-update-plugin" key is correct.

 

hosting server: plesk V18.0.52
php: 7.4
composer: v 2.5.8

composer.json file on /httpsdocs/

{
    "name": "msp/cashondelivery",
    "description": "",
    "require": {
        "php": "~7.3.0||~7.4.0||~8.0.0||~8.1.0||~8.2.0",
        "msp/common": "*",
        "magento/magento-composer-installer": "*",
		"magento/composer-root-update-plugin": "~1.0",
        "composer-root-update-plugin": "~2.0"
    },
    "suggest": {
    },
    "type": "magento2-module",
    "license": "OSL-3.0",
    "autoload": {
        "files": [
            "registration.php"
        ],
        "psr-4": {
            "MSP\\CashOnDelivery\\": ""
        }
    },
    "config": {
        "allow-plugins": {
            "magento/magento-composer-installer": true
        }
    }
}

Even if I remove the "magento/composer-root-update-plugin": "~1.0" line from the composer.json file, i am still gives the same error, which makes me wonder if I'm in the right composer file.

 

I have locating composer.json files in:

/var/www/vhosts/mydomain.com/

/var/www/vhosts/mydomain.com/httpdocs

/var/www/vhosts/mydomain.com/.phpenv/shims

 

I try to understood if is a magento or plesk error

 

Could you please assist me in resolving this problem?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Update Magento 2.3.4 to 2.4.x version, require.composer-root-update-plugin is invalid...

Hello @Astergios 

 

  1. Verify the correct composer.json file: Make sure you are editing the correct composer.json file that belongs to your Magento project. Based on the paths you mentioned, the correct file should be located in /var/www/vhosts/mydomain.com/httpdocs.

  2. Remove the incorrect entry: In your composer.json file, remove the line "composer-root-update-plugin": "~2.0" from the require section. The correct key to include the magento/composer-root-update-plugin package should be "magento/composer-root-update-plugin": "~1.0". Once you have removed the incorrect entry, save the file.

  3. Update Composer: Ensure that you are using the latest version of Composer. Run the following command to update Composer to the latest version:

    composer self-update
  4. Run Composer commands: After making the necessary changes, try running the Composer commands again:

    composer require magento/composer-root-update-plugin=~1.0 --no-update
    composer update
    composer validate

If the issue persists after following these steps, you may need to investigate further by examining the full contents of your composer.json file, including any additional dependencies or customizations you have. Additionally, check for any conflicting or duplicated entries in the composer.json file.

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

View solution in original post

2 REPLIES 2

Re: Update Magento 2.3.4 to 2.4.x version, require.composer-root-update-plugin is invalid...

Hello @Astergios 

 

  1. Verify the correct composer.json file: Make sure you are editing the correct composer.json file that belongs to your Magento project. Based on the paths you mentioned, the correct file should be located in /var/www/vhosts/mydomain.com/httpdocs.

  2. Remove the incorrect entry: In your composer.json file, remove the line "composer-root-update-plugin": "~2.0" from the require section. The correct key to include the magento/composer-root-update-plugin package should be "magento/composer-root-update-plugin": "~1.0". Once you have removed the incorrect entry, save the file.

  3. Update Composer: Ensure that you are using the latest version of Composer. Run the following command to update Composer to the latest version:

    composer self-update
  4. Run Composer commands: After making the necessary changes, try running the Composer commands again:

    composer require magento/composer-root-update-plugin=~1.0 --no-update
    composer update
    composer validate

If the issue persists after following these steps, you may need to investigate further by examining the full contents of your composer.json file, including any additional dependencies or customizations you have. Additionally, check for any conflicting or duplicated entries in the composer.json file.

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: Update Magento 2.3.4 to 2.4.x version, require.composer-root-update-plugin is invalid...

Hi @Astergios,

 

It seems that there might be an issue with the syntax or structure of the composer.json file. The error message you're encountering indicates that there is an invalid value for the require.composer-root-update-plugin key.

Here are a few steps you can take to resolve the issue:

  • Check composer.json Syntax: Ensure that the composer.json file has the correct syntax. Look for any typos, extra commas, or other syntax errors. Make sure the require section is properly formatted.
  • Verify composer-root-update-plugin Requirement: Confirm that the require section includes the correct entry for the composer-root-update-plugin. It should look something like this:

In composer.json file:

"require": {
    "magento/composer-root-update-plugin": "~1.0",
    // other dependencies...
}

Try changing your value to this to make it work.

Update Composer: Make sure you are using an updated version of Composer. Run the following command to update Composer:

composer self-update

Clear Composer Cache: Sometimes, issues can arise due to cached data. Try clearing the

 

Composer cache:

 

Composer clear cache

 

Manually Edit composer.json:

If the issue persists, try manually editing the composer.json file. Open the file and ensure that the require section looks correct. Save the changes and then try running the Composer commands again.

 

Check Composer Version Compatibility:

Ensure that the version of Magento you are trying to update to is compatible with the version of Composer you are using. Refer to the Magento documentation for compatibility information.
After making these changes, try running the composer update and other commands again

If the issue will be resolved, Click Kudos & Accept as a Solution.