I tried to following steps to upgrade from 2.1.8 to 2.2.1 as mentioned in linked question:

bin/magento maintenance:enable
composer require magento/product-community-edition 2.2.0 --no-update
composer update
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf var/generation/*
chmod +x bin/magento
bin/magento setup:upgrade
bin/magento maintenance:disable

but received the following error:

The requested package magento/product-community-edition 2.2.1 exists as magento/product-community-edition[2.1.8] but these are rejected by your constraint.

I can't see 2.1.8 anywhere in my composer.json file, but still received this error. Please let me know where should I fix?

Updating my Composer.json file:

        "name": "magento/project-community-edition",
        "description": "eCommerce Platform for Growth (Community Edition)",
        "type": "project",
        "version": "2.2.1",
        "license": [
        "require": {
            "magento/product-community-edition": "2.2.1",
            "composer/composer": "@alpha"
    "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"
    "config": {
        "use-include-path": true
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        "psr-0": {
            "": "app/code/"
        "files": [
    "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": "alpha",



1 Answer 1


Step 1: Access Your Server via SSH

You need to connect your server via SSH.

Step 2: Navigate to the Magento 2 Root Directory

Once your SSH connection is up, you will need to move to your target application folder. In that application folder, you will find the public_html folder which is the root directory of Magento 2.

Step 3: Upgrade Commands

composer require magento/product-community-edition 2.2 --no-update

Then execute this all commands

 composer update
 rm -rf var/di var/generation
 php bin/magento setup:upgrade
 php bin/magento setup:di:compile
 php bin/magento cache:clean
 php bin/magento cache:flush
 php bin/magento indexer:reindex
  • Hi Rohan, My root folder is /var/www/html/magento and hosted in AWS. In step 3, after typing composer update I'm getting the error mentioned in my question. I could not see 2.1.8 in composer.json. Not sure how composer is picking 2.1.8.
    – Vaish
    Nov 17, 2017 at 8:34
  • 1
    After replacing my comoser.json and composer.lock files with magento 2.2.1 repository composer files, I successfully migrated Magento 2.2.1. Thanks for the help.
    – Vaish
    Nov 19, 2017 at 7:04
  • Happy to helping :) Happy Coding !!! Nov 20, 2017 at 4:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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