Magento – Could not find a matching version of package magento/product-community-edition

magento-2.1magento2.2.6upgrade

I am working on the upgrade process of Magento from version 2.1.9 to 2.2.6.

When I run the below command:

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

I got below error:

Could not find a matching version of package magento/product-community-edition. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (alpha). 

I am following the below document:

https://devdocs.magento.com/guides/v2.2/comp-mgr/cli/cli-upgrade.html

What is going wrong here?

following is my composer.json

    {
    "name": "magento/magento2ce",
    "description": "Magento 2 (Community Edition)",
    "type": "project",
    "version": "2.1.9",
    "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.7.7",
        "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",
        "zendframework/zend-config": "~2.4.6",
        "zendframework/zend-form": "~2.4.6",
        "zendframework/zend-di": "~2.4.6",
        "zendframework/zend-serializer": "~2.4.6",
        "zendframework/zend-log": "~2.4.6",
        "zendframework/zend-http": "~2.4.6",
        "magento/zendframework1": "~1.12.16",
        "colinmollenhour/credis": "1.6",
        "colinmollenhour/php-redis-session-abstract": "1.2",
        "colinmollenhour/cache-backend-redis": "1.9",
        "colinmollenhour/cache-backend-file": "1.4",
        "composer/composer": "<=1.0.0-beta1",
        "monolog/monolog": "1.16.0",
        "oyejorge/less.php": "~1.7.0",
        "pelago/emogrifier": "0.1.1",
        "tubalmartin/cssmin": "2.4.8-p4",
        "magento/magento-composer-installer": "*",
        "braintree/braintree_php": "3.7.0",
        "symfony/console": "~2.3 <2.7",
        "symfony/event-dispatcher": "~2.1",
        "symfony/process": "~2.1",
        "phpseclib/phpseclib": "2.0.*",
        "tedivm/jshrink": "~1.0.1",
        "magento/composer": "~1.0.0",
        "lib-libxml": "*",
        "ext-ctype": "*",
        "ext-gd": "*",
        "ext-spl": "*",
        "ext-dom": "*",
        "ext-simplexml": "*",
        "ext-mcrypt": "*",
        "ext-hash": "*",
        "ext-curl": "*",
        "ext-iconv": "*",
        "ext-intl": "*",
        "ext-xsl": "*",
        "ext-mbstring": "*",
        "ext-openssl": "*",
        "ext-zip": "*",
        "sjparkinson/static-review": "~4.1",
        "magento/data-migration-tool": "2.1.9",
        "mailchimp/mc-magento2": "^1.0",
        "msp/recaptcha": "^2.0"
    },
    "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.3",
        "magento/module-advanced-pricing-import-export": "100.1.3",
        "magento/module-authorization": "100.1.2",
        "magento/module-authorizenet": "100.1.5",
        "magento/module-backend": "100.1.4",
        "magento/module-backup": "100.1.3",
        "magento/module-braintree": "100.1.6",
        "magento/module-bundle": "100.1.4",
        "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.9",
        "magento/module-catalog-import-export": "100.1.6",
        "magento/module-catalog-inventory": "100.1.6",
        "magento/module-catalog-rule": "100.1.4",
        "magento/module-catalog-rule-configurable": "100.1.3",
        "magento/module-catalog-search": "100.1.7",
        "magento/module-catalog-url-rewrite": "100.1.4",
        "magento/module-catalog-widget": "100.1.3",
        "magento/module-checkout": "100.1.8",
        "magento/module-checkout-agreements": "100.1.2",
        "magento/module-cms": "101.0.7",
        "magento/module-cms-url-rewrite": "100.1.2",
        "magento/module-config": "100.1.6",
        "magento/module-configurable-import-export": "100.1.3",
        "magento/module-configurable-product": "100.1.9",
        "magento/module-contact": "100.1.3",
        "magento/module-cookie": "100.1.2",
        "magento/module-cron": "100.1.3",
        "magento/module-currency-symbol": "100.1.3",
        "magento/module-customer": "100.1.8",
        "magento/module-customer-import-export": "100.1.4",
        "magento/module-deploy": "100.1.5",
        "magento/module-developer": "100.1.3",
        "magento/module-dhl": "100.1.3",
        "magento/module-directory": "100.1.4",
        "magento/module-downloadable": "100.1.3",
        "magento/module-downloadable-import-export": "100.1.2",
        "magento/module-eav": "100.1.6",
        "magento/module-email": "100.1.5",
        "magento/module-encryption-key": "100.1.2",
        "magento/module-fedex": "100.1.3",
        "magento/module-gift-message": "100.1.4",
        "magento/module-google-adwords": "100.1.2",
        "magento/module-google-analytics": "100.1.2",
        "magento/module-google-optimizer": "100.1.2",
        "magento/module-grouped-import-export": "100.1.2",
        "magento/module-grouped-product": "100.1.4",
        "magento/module-import-export": "100.1.4",
        "magento/module-indexer": "100.1.3",
        "magento/module-integration": "100.1.5",
        "magento/module-layered-navigation": "100.1.2",
        "magento/module-media-storage": "100.1.3",
        "magento/module-msrp": "100.1.3",
        "magento/module-multishipping": "100.1.2",
        "magento/module-new-relic-reporting": "100.1.3",
        "magento/module-newsletter": "100.1.4",
        "magento/module-offline-payments": "100.1.2",
        "magento/module-offline-shipping": "100.1.3",
        "magento/module-page-cache": "100.1.4",
        "magento/module-payment": "100.1.7",
        "magento/module-paypal": "100.1.6",
        "magento/module-persistent": "100.1.3",
        "magento/module-product-alert": "100.1.3",
        "magento/module-product-video": "100.1.6",
        "magento/module-quote": "100.1.5",
        "magento/module-reports": "100.1.5",
        "magento/module-require-js": "100.1.3",
        "magento/module-review": "100.1.4",
        "magento/module-rss": "100.1.3",
        "magento/module-rule": "100.1.5",
        "magento/module-sales": "100.1.8",
        "magento/module-sales-rule": "100.1.4",
        "magento/module-sales-inventory": "100.1.1",
        "magento/module-sales-sequence": "100.1.3",
        "magento/module-sample-data": "100.1.3",
        "magento/module-search": "100.1.3",
        "magento/module-security": "100.1.3",
        "magento/module-send-friend": "100.1.2",
        "magento/module-shipping": "100.1.3",
        "magento/module-sitemap": "100.1.4",
        "magento/module-store": "100.1.7",
        "magento/module-swagger": "100.1.2",
        "magento/module-swatches": "100.1.8",
        "magento/module-swatches-layered-navigation": "100.1.2",
        "magento/module-tax": "100.1.3",
        "magento/module-tax-import-export": "100.1.2",
        "magento/module-theme": "100.1.7",
        "magento/module-translation": "100.1.3",
        "magento/module-ui": "100.1.7",
        "magento/module-ups": "100.1.4",
        "magento/module-url-rewrite": "100.1.3",
        "magento/module-user": "100.1.3",
        "magento/module-usps": "100.1.4",
        "magento/module-variable": "100.1.2",
        "magento/module-vault": "100.2.2",
        "magento/module-version": "100.1.2",
        "magento/module-webapi": "100.1.4",
        "magento/module-webapi-security": "100.1.2",
        "magento/module-weee": "100.1.2",
        "magento/module-widget": "100.1.5",
        "magento/module-wishlist": "100.1.6",
        "magento/theme-adminhtml-backend": "100.1.2",
        "magento/theme-frontend-blank": "100.1.6",
        "magento/theme-frontend-luma": "100.1.7",
        "magento/language-de_de": "100.1.1",
        "magento/language-en_us": "100.1.1",
        "magento/language-es_es": "100.1.1",
        "magento/language-fr_fr": "100.1.1",
        "magento/language-nl_nl": "100.1.1",
        "magento/language-pt_br": "100.1.1",
        "magento/language-zh_hans_cn": "100.1.1",
        "magento/framework": "100.1.9",
        "trentrichardson/jquery-timepicker-addon": "1.4.3",
        "components/jquery": "1.11.0",
        "blueimp/jquery-file-upload": "5.6.14",
        "components/jqueryui": "1.10.4",
        "twbs/bootstrap": "3.1.0",
        "tinymce/tinymce": "3.4.7"
    },
    "extra": {
        "component_paths": {
            "trentrichardson/jquery-timepicker-addon": "lib/web/jquery/jquery-ui-timepicker-addon.js",
            "components/jquery": [
                "lib/web/jquery.js",
                "lib/web/jquery/jquery.min.js",
                "lib/web/jquery/jquery-migrate.js"
            ],
            "blueimp/jquery-file-upload": "lib/web/jquery/fileUploader",
            "components/jqueryui": [
                "lib/web/jquery/jquery-ui.js"
            ],
            "twbs/bootstrap": [
                "lib/web/jquery/jquery.tabs.js"
            ],
            "tinymce/tinymce": "lib/web/tiny_mce"
        }
    },
    "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": [
            "app/etc/NonComposerComponentRegistration.php"
        ]
    },
    "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",
    "prefer-stable": true,
    "repositories": {
        "magento": {
            "type": "composer",
            "url": "https://repo.magento.com"
        }
    }
}

Best Answer

These 2 things worked for me

  1. I needed to add the repository reference to my composer.json because it wasn't there

    "repositories": [
             {
                 "type": "composer",
                "url": "https://repo.magento.com/"
            }
        ],
    
  2. I needed to rename my auth.json.sample to auth.json and add the public and private keys to the json.

    {
        "http-basic": {
            "repo.magento.com": {
                "username": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
            }
        }
     }
    

If you want to input your private and public keys manually then do not include the auth.json