0

Last year I migrated from 1.7 to 2.1.7. I used

$ composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .

to create the Magento installation which I believe it is called the metapackage installation method.

Now I encounter difficulties to upgrade 2.1.7 and I already tried the standard procedure with composer to upgrade which should be possible, but I cannot see what's going wrong. I cannot upgrade with the Web setup upgrade because the notification says it is a git clone also.

Doing the following

$ composer require magento/product-community-edition 2.1.14 --no-update

$ composer update

gives me errors about dependencies of Magento itself (not other custom modules). My composer.json file looks very standard and it is quite similair as on github

Here is a part of my composer.json file.

    {
        "name": "magento/magento2ce",
        "description": "Magento 2 (Community Edition)",
        "type": "project",
        "version": "2.1.7",
        "license": [
            "OSL-3.0",
            "AFL-3.0"
        ],
        "require": {
            "php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
            "zendframework/zend-stdlib": "~2.4.6",
            "zendframework/zend-code": "~2.4.6",
            "zendframework/zend-server": "~2.4.6",
            "zendframework/zend-soap": "~2.4.6",
            "zendframework/zend-uri": "~2.4.6",
            "zendframework/zend-validator": "~2.4.6",
            "zendframework/zend-crypt": "~2.4.6",
            "zendframework/zend-console": "~2.4.6",
            "zendframework/zend-modulemanager": "~2.4.6",
            "zendframework/zend-mvc": "~2.4.6",
            "zendframework/zend-text": "~2.4.6",
            "zendframework/zend-i18n": "~2.4.6",
            "zendframework/zend-eventmanager": "~2.4.6",
            "zendframework/zend-view": "~2.4.6",
            "zendframework/zend-servicemanager": "~2.4.6",
            "zendframework/zend-json": "~2.4.6",

 ...
        },
        "require-dev": {
            "phpunit/phpunit": "4.1.0",
            "squizlabs/php_codesniffer": "1.5.3",
            "phpmd/phpmd": "@stable",
            "pdepend/pdepend": "2.4.0",
            "fabpot/php-cs-fixer": "~1.2",
            "lusitanian/oauth": "~0.3 <=0.7.0",
            "sebastian/phpcpd": "2.0.0"
        },
        "replace": {
            "magento/module-marketplace": "100.1.2",
            "magento/module-admin-notification": "100.1.2",
            "magento/module-advanced-pricing-import-export": "100.1.2",
            "magento/module-authorization": "100.1.2",
            "magento/module-authorizenet": "100.1.5",
            "magento/module-backend": "100.1.3",
            "magento/module-backup": "100.1.2",
            "magento/module-braintree": "100.1.6",
            "magento/module-bundle": "100.1.3",
            "magento/module-bundle-import-export": "100.1.3",
            "magento/module-cache-invalidate": "100.1.3",
            "magento/module-captcha": "100.1.3",
            "magento/module-catalog": "101.0.7",
            "magento/module-catalog-import-export": "100.1.4",
            "magento/module-catalog-inventory": "100.1.5",
            "magento/module-catalog-rule": "100.1.4",
            "magento/module-catalog-rule-configurable": "100.1.3", 

...

Trying to just copy the composer.json 2.1.18 file won't update the core files, right? What am I doing wrong that it won't work with the normal composer update? Do I just have to download the 2.1.14 archive and copy and overwrite the Magento root?

2 Answers 2

0

Composer has the --with-dependencies flag which should resolve this for you. So the order of commands would be:

$ composer require magento/product-community-edition 2.1.14 --no-update

Then

$ composer update magento/product-community-edition --with-dependencies

EDIT:

WARNING: Before trying the below, please make a backup.

You could try replacing your composer.json file with the one below (which is one I just grabbed from a blank install on my env), then require any of the third party modules you needed using composer.

{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.1.14",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/product-community-edition": "2.1.14",
        "composer/composer": "@alpha"
    },
    "require-dev": {
        "phpunit/phpunit": "~6.2.0",
        "squizlabs/php_codesniffer": "3.2.2",
        "phpmd/phpmd": "@stable",
        "pdepend/pdepend": "2.5.2",
        "friendsofphp/php-cs-fixer": "~2.2.1",
        "lusitanian/oauth": "~0.8.10",
        "sebastian/phpcpd": "2.0.4"
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": [
                "app/code/"
            ]
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ],
        "exclude-from-classmap": [
            "**/dev/**",
            "**/update/**",
            "**/Test/**"
        ]
    },
    "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/"
        }
    },
    "minimum-stability": "stable",
    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.magento.com/"
        }
    ],
    "extra": {
        "magento-force": "override"
    }
}

Then in a bash terminal run $ rm -rf vendor/ composer.lock then run $ composer install and then $ composer update magento/product-community-edition --with-dependencies

With this method you might end up with an autoload error, that may just be because you have some core modules loaded into app/. You would need to run in a bash terminal $ rm -rf app/code/Magento/* && rm -rf app/design/frontend/Magento/* && rm -rf app/design/adminhtml/Magento/*

8
  • Thanks for your reply. With the flag --with-dependencies I get the following conflicts.
    – Sai
    Aug 18, 2018 at 20:51
  • I took a good look at how I installed Magento 2.1.7 at the beginning. $ composer create-project -s stable --prefer-dist magento/community-edition .
    – Sai
    Aug 24, 2018 at 9:00
  • So this may be complicated or impossible to upgrade the official way? What could be the best approach to tackle this problem?
    – Sai
    Aug 24, 2018 at 9:28
  • @Sai I've added an extra section to my answer that might help. I can't confirm it works, so be sure to make a backup. Aug 24, 2018 at 17:11
  • Yes, this is the right way to solve my problem. I have been busy with this for a long time and now it's actually possible to upgrade my installation of 2.1.4 to 2.1.14. Thanks for your useful answer.
    – Sai
    Aug 25, 2018 at 20:57
0
$ composer update magento/product-community-edition --with-dependencies
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package colinmollenhour/credis (locked at 1.6, required as 1.8.2) is satisfiable by colinmollenhour/credis[1.6] but these conflict with your requirements or minimum-stability.
  Problem 2
    - The requested package colinmollenhour/php-redis-session-abstract (locked at v1.2, required as 1.3.4) is satisfiable by colinmollenhour/php-redis-session-abstract[v1.2] but these conflict with your requirements or minimum-stability.
  Problem 3
    - Installation request for magento/magento2ce 2.1.14 -> satisfiable by magento/magento2ce[2.1.14].
    - magento/product-community-edition 2.1.14 requires magento/magento2-base 2.1.14 -> satisfiable by magento/magento2-base[2.1.14].
    - don't install magento/magento2-base 2.1.14|remove magento/magento2ce 2.1.14
    - Installation request for magento/product-community-edition 2.1.14 -> satisfiable by magento/product-community-edition[2.1.14].

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.