75 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,687
67 votes
Accepted

How to update Magento2 using composer

Edit the composer.json file on root folder and change the version of magento in line 5: "version": "2.0.1", and under "require" "require": { "magento/product-community-edition": "2.0.1", Now run: ...
tecjam's user avatar
  • 4,033
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
42 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

Magento 2 - Uninstallable set of packages when deploying magento-sample-data

Had the same problem. Fixed with going to the root directory and specifying the repositories for composer with the following command (use https to avoid composer warning): composer config ...
rnli's user avatar
  • 401
26 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
19 votes
Accepted

Magento 2 - Uninstallable set of packages when deploying magento-sample-data

I've also been struggling to install the sample data. It appears that somthing is currently broken here (Oct 2015) and the instructions in the devdocs didn't work for me either. I was experiencing the ...
fbrnc's user avatar
  • 614
18 votes

Why `code` folder is missing under `app` folder in magento 2 stable version?

app/code is missing because all Magento modules are put to vendor directory for 3rd-party developers convenience, so they do not have to mix their own code with the core. Now it is easy to develop ...
Alex Paliarush's user avatar
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,662
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
13 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
  • 308
12 votes
Accepted

Magento 2 Enterprise: Create New Module in vendor directory

Custom modules should not be developed in vendor directory. Copy content from vendor/magento/magento2-base to the root of the project, create custom .gitignore as described here and initialize new git ...
Alex Paliarush's user avatar
12 votes
Accepted

Magento2: different kind of composer.json files

This is the way to go: "autoload": { "files": [ "registration.php" ], "psr-4": { "Amit\\SamplePage\\": "" } } The map function in Composer: "extra": { "map": [ ...
Silvan's user avatar
  • 1,337
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
  • 131
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.8k
11 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
  • 518
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.6k
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
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
  • 2,998
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.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,209
8 votes

Choose which file to install via Composer based on Magento version

I don't have a workaround and it wasn't an issue for me yet, but I have a proposal that could work: You need to maintain separate version branches to target different Magento versions. Deploying ...
Fabian Schmengler's user avatar
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

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,127

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