Magento 2 marketplace extension installing error: Do not run Composer as root/super user!
Domanda
I am trying to install an extension with the help of composer for magento 2. This is my composer.json file
{
"name": "ankur/module-quickorder",
"description": "N/A",
"require": {
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.0.0",
"magento/module-backend": "100.0.0",
"magento/module-media-storage": "100.0.0",
"lib-libxml": "*"
},
"type": "magento2-module",
"version": "100.0.0",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [ "registration.php" ],
"psr-4": {
"Ankur\\Quickorder\\": ""
}
}
}
After creating a composer, when I run this command in putty
composer require ankur/module-quickorder:100.0.0'
It throws below error in putty
Installation issue: Do not run Composer as root/super user! See [https://getcomposer.org/root][1] for details
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
If anyone can explain the process of installing an extension with the help of composer, it will be appreciated.
Soluzione
Installation issue: Do not run Composer as root/super user! See [https://getcomposer.org/root][1] for details
This is "just" a warning. It does not prevent composer from being executed, it tells you that you what you are doing is risky because composer can execute shell scripts, so do not do it if you do not absolutely trust the sources of the installed packages (hint: you should not).
But the reason you cannot install the extension is this:
Your requirements could not be resolved to an installable set of packages.
Usually this message is followed by more details, take a look again.
Without knowing your project composer.json (not the one of the extension) and the exact error message, I can only give you hints:
The project composer.json must contain repo.magento.com
in the repositories
section. If you installed the metapackage, it should be there. If not, maybe you installed Magento from Github or from zip file? Then you cannot use composer.
You also need your authentication keys for the marketplace: http://devdocs.magento.com/guides/v2.1/install-gde/prereq/connect-auth.html
By the way, I am wondering why you know the contents of the extensions composer.json - that sounds like you downloaded it somewhere and try to install it from the downloaded files. This is not how it's supposed to work: Composer connects to the marketplace to download and install the extension automatically.
Altri suggerimenti
You can allow composer to run as root by copy and paste this line into your terminal:
export COMPOSER_ALLOW_SUPERUSER=1
Becasue running composer as root is not advisable, try to use this option with caution