Magento – Error in using composer to install a module in Magento 2.0

composerimportmagento2

I have used Composer for installing other modules specially from github and they worked fine. However I have problem installing the following module to Magento 2.0 .
The module I want to install is fireGento_FastSimpleImport2: https://github.com/firegento/FireGento_FastSimpleImport2

and the composer name is: firegento/fastsimpleimport2

However when I write in terminal the following command in Magento root directory:

sudo composer require firegento/fastsimpleimport2

I get the follwing error:

[InvalidArgumentException]
Could not find package firegento/fastsimpleimport2 at any version for
your minimum-stability (alpha) . Check the package spelling or
your minimum-stability

I have contacted them and I'm waiting for their response, but sharing this here can also solve someone else's problem.

Update

This is our Magento 2.0.5 composer.json:

{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.0.5",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/firegento/FireGento_FastSimpleImport2.git"
        },
        {
            "type": "composer",
            "url": "https://repo.magento.com/"
        }
    ],
    "require": {
        "magento/product-community-edition": "2.0.5",
        "composer/composer": "@alpha"
    },
    "require-dev": {
        "phpunit/phpunit": "4.1.0",
        "squizlabs/php_codesniffer": "1.5.3",
        "phpmd/phpmd": "2.3.*",
        "pdepend/pdepend": "2.2.2",
        "sjparkinson/static-review": "~4.1",
        "fabpot/php-cs-fixer": "~1.2",
        "lusitanian/oauth": "~0.3 <=0.7.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": [
            "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,
    "extra": {
        "magento-force": "override"
    }
}

We run the following command from root of our magento installation:
sudo composer require firegento/fastsimpleimport2

I still get the same error. Any thoughts?

Best Answer

In order to install Github packages through composer.json you have to define it as repository like this:

{
    "repositories": [
        {      "url":"https://github.com/firegento/FireGento_FastSimpleImport2.git",
            "type": "git"
        }
    ],
}

if that doesn't work, then open your terminal and enter

composer config repositories.fastsimpleimport2 vcs https://github.com/firegento/FireGento_FastSimpleImport2.git

after that run the require command again.

composer require firegento/fastsimpleimport2

Related Topic