Skip to main content
Share Your Experience: Take the 2024 Developer Survey
76 votes
Accepted

How to install a specific Magento 2 version with Composer?

You can try below command: composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.1.7 /installation/directory/path
Jarnail S's user avatar
  • 4,697
51 votes

How to update Magento2 using composer

Updating/Upgrading to Magento 2.0.5 (via composer) php bin/magento maintenance:enable composer require magento/product-community-edition 2.0.5 --no-update composer update rm -rf var/di var/generation ...
Mukesh Chapagain's user avatar
45 votes

Magento 2.4.1 setup:install problem : "the default website isn't defined. Set the website and try again."

It appears that this error might appear when a MySQL database is empty, but the env.php file is present. (Possibly because you had setup Magento, but for some reason, database was deleted.) To fix ...
Aleksandrs Rivkinds's user avatar
30 votes

M2.4 Exception throwing while executing composer require: Higher matching version 2.3.x of xxx/module-xxxx was found in public repository packagist

When you have a module with a same name at packagist.org and at magento marketplace, and the first is newer than the second, this error will happen. This is caused by magento/composer-dependency-...
Ricardo Martins's user avatar
24 votes
Accepted

Magento 2.1.1 not compatibile with PHP 7.1.0

Update - September 2017: Magento 2.2 now officially supports PHP 7.1, so that's the Magento version you should aim for from now on if PHP 7.1 is something you want or need on your platform. Original ...
TiEul's user avatar
  • 1,297
17 votes
Accepted

ReflectionException error on Magento 2

It seems that this module need a special library. If we take a look into the composer.json file located in the module files we can find that he required this library : "require" : { "ebizmarts/...
Alin Lupoiu's user avatar
  • 2,672
16 votes

How to update Magento2 using composer

When upgrading through composer, you can choose the version of which you need to upgrade via a composer upgrade. For example: composer require magento/product-community-edition 2.1.2 --no-update The ...
Richard Cripps's user avatar
16 votes
Accepted

Explanation of app/code vs vendor directories please

Magento 2 advocates the use of composer for managing modules, when you install a module through composer it is added to vendor/<vendor-name>/<module>. You should not edit any code inside ...
oscarpas's user avatar
  • 910
14 votes

Magento 2.4.1 setup:install problem : "the default website isn't defined. Set the website and try again."

I was changing a db and removing env.php helped to get rid of the error for me.
jekabs's user avatar
  • 318
12 votes

Install extension using composer Magento 2

Follow below steps to install magento2 extension (2.1.7) cd <your Magento install dir> composer require <component-name>:<version> --no-update composer update bin/magento setup:...
mshakeel's user avatar
  • 528
12 votes

Package fabpot/php-cs-fixer is abandoned message in Magento 2

As the existing answers are not quite clear about it: this is not an error, only a warning. The abandoned package still exists, and Magento already replaced the dependency somewhere in version 2.1 so ...
Fabian Schmengler's user avatar
12 votes

Magento2 : Composer Problem Could not find a matching version of package <name>. Check the package spelling, your version

I had the same problem (also with this extension). For anyone who is facing an issue with installing any Magento Marketplace extension with Composer: please check your auth.json for the correct ...
MrPaulsky's user avatar
  • 231
12 votes
Accepted

Why Composer install is asking to allow-plugins?

Composer 2.2 comes with a new security feature, it does not trust plugins by default unless you specify it in the composer file, in July 2022 plugins will no longer be executed if they aren't ...
KAndy's user avatar
  • 20.9k
11 votes

What are the best practices for installing third party extensions in Magento 2?

Install module via composer is the best way to Magento 2. Becuase there are many advantages if we install module via composer. If you want to upgrade module you just need to change the version in ...
Prince Patel's user avatar
  • 22.7k
10 votes
Accepted

PHP requirement incompatible with your PHP version | Composer module installation error

Another solution is to run composer with the --ignore-platform-reqs argument. Then it won't check system requirements like PHP version and PHP extensions.
Fabian Schmengler's user avatar
10 votes

Problems with friendsofphp/php-cs-fixer and php7.3

1.composer require magento/composer-root-update-plugin=~1.0 --no-update open composer.json and change: from - "friendsofphp/php-cs-fixer": "~2.xx.x", to + "...
Vvvaida's user avatar
  • 568
10 votes
Accepted

Magento 2.4.3 and Composer error messages for allure phpunit and ramsey uuid - Can't continue with update

Magento 2.4.3 composer.json Taking a look at the 2.4.3 codebase, it looks like the composer.json has newer require-dev dependencies than what you have posted. Typically when doing upgrades, among ...
sdaugherty's user avatar
  • 1,231
9 votes
Accepted

Magento 2: How to Specify "Semantic Versioning" Dependencies in my Module's composer.json

Do I need to manually look at my module everytime I use a piece of core Magento code and add a require:... line to composer.json? Yes, every time in your code you use anything from a core module you ...
Kristof at Fooman's user avatar
9 votes

Magento 2.1.1 not compatibile with PHP 7.1.0

There are two possibilities: The devdocs are wrong and PHP 7.1 is not supported The requirement in composer.json is wrong. Since Magento 2.1 was released before PHP 7.1, it is most likely option (2) ...
Fabian Schmengler's user avatar
9 votes

How to Uninstall modules in Magento 2 using composer?

You can uninstall a module through composer if it was installed using composer. If yes then issue command: php bin/magento module:uninstall -r <Vendor>_<Module> -r flag removes module ...
Devtype's user avatar
  • 3,008
9 votes
Accepted

Get the composer version of installed modules

Maybe my code can be useful for you (tested in the observer): /** * @var \Magento\Framework\App\DeploymentConfig */ protected $deploymentConfig; /** * @var \Magento\Framework\Component\...
Siarhey Uchukhlebau's user avatar
9 votes
Accepted

Magento 2: usage of composer.json file?

Magento 2 uses Composer, a PHP dependency manager, to package components and product editions. Composer is a dependency management for PHP and in Magento 2, the composer plays the role in gathering ...
Prince Patel's user avatar
  • 22.7k
8 votes
Accepted

Magento 2: What's the deployManager?

That is an outdated part of code which is not even used in magento 2. It resulted from the fork of the composer installer for magento 1 which has multiple additional features to extend magento 1 via ...
Flyingmana's user avatar
  • 6,137
8 votes
Accepted

Magento2: How to include third pary module through composer.json in custom module

You should only run composer install or composer update in the "root project". In your case this is the Magento installation. But since it seems like you did not add your custom module with composer ...
Fabian Schmengler's user avatar
8 votes
Accepted

How to deploy public PHP files in Magento 2 extension?

First part is how to do this from an extension builder perspective. I'm leaving the second part as reference for project builders. Extension builder answer: You can't do this from within an ...
Vincent Hornikx's user avatar
8 votes

How to install modules in app/code with composer in Magento 2

I'm answering my own question, so it will be beneficial for someone else later, To be able to install in a custom path, your module must support composer/installers so add it to your module's require ...
nuwaus's user avatar
  • 2,314
8 votes

Magento 2: Composer update / install is no longer copying magento2-base structure

Found it! Turned out in a previous commit I accidentally removed the following from my composer.json-file: "extra": { "magento-force": "override" } Turns out that Magento uses this variable to ...
Giel Berkers's user avatar
  • 12.3k
8 votes

Cannot upgrade from 2.2.6 to 2.3 via composer

First be sure you are running PHP 7.1 or 7.2 Update your composer run those commandes: composer require magento/product-community-edition=2.3.0 --no-update Specify additional packages for ...
SoCix's user avatar
  • 492
8 votes

Upgrade to magento 2.4.3

For community edition composer require magento/product-community-edition=2.4.3 --no-update For enterprise edition composer require magento/product-enterprise-edition=2.4.3 --no-update composer ...
Sagar Dobariya's user avatar
7 votes

How to update Magento2 using composer

To update Magento 2.0.x with sample data, I followed these steps (also works to update to 2.1 RC): Apply this commit manually (it's a bugfix for the sample data that is released with 2.1) Reset the ...
Fabian Schmengler's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible