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
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:
...
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
...
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 ...
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 ...
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-...
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 ...
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 ...
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 ...
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/...
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 ...
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 ...
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.
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 ...
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": [
...
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 ...
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 ...
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 ...
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:...
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 ...
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.
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 + "...
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 ...
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) ...
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 ...
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\...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
composer × 725magento2 × 497
upgrade × 95
installation × 69
module × 68
extensions × 57
magento-2.1 × 53
magento2.3 × 48
php × 36
magento2.4 × 26
git × 25
magento-upgrade × 22
error × 19
magento2.2 × 18
sample-data × 18
composer-update × 17
magento-1.9 × 16
marketplace × 16
third-party-module × 14
vendor × 14
patches × 13
php-7 × 12
cli × 11
theme × 10
setup × 10