I can't seem to be able to update my magento2 ce using composer. I doesn't find any updates, the only one it found was 'fabpot'.
I thought this was the whole point of a composer setup, so why would I want to use the backend as explained in the documentation: http://devdocs.magento.com/guides/v2.0/comp-mgr/upgrader/upgrade-start.html
Or am I missing something?
Thanks in advance for any help.
EDIT:
I followed the official documentation to install Magento2 via composer, as described here: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/integrator_install.html#integrator-first-composer-ce
The problem is that the composer.json file that is pulled using the command:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <installation directory name> defined magento under the required section of the .json:
"require": {
"magento/product-community-edition": "2.0.0",
"composer/composer": "@alpha",
"firegento/magesetup2": "dev-develop",
"splendid/de_de": "^0.0.1"
},
As you can see, version 2.0.0 is specified.
For the update to work, I had to manually change that line in the .json file as follows:
"magento/product-community-edition": "2.*",
Now running composer update updated all modules from version 100.0.2 to 100.0.3.
Please note that this still throws an error exception because of the following:
[ErrorException]
Source /home/dev/git/mysite/vendor/magento/magento2-base/app/design/frontend/Magento does not exist
Now it seems quite a few essential are missing, for example the bin/magento file.
Anyone got any ideas how it is done correctly so it actually works?
-
If you installed 2.0 via packagist, there is an issue with 2.0.1. Please add repo.magento.com to your composer.json, and related auth info in the auth.json file.Maddy– Maddy2016年01月22日 15:35:30 +00:00Commented Jan 22, 2016 at 15:35
-
Upgrade magento 2 using composer required many technical knowledge about command line. If you are not tech-savvy, maybe upgrade via admin, magento commerce. Sometimes the composer method failed because of missing dependencies.D. Joes– D. Joes2016年09月08日 09:27:51 +00:00Commented Sep 8, 2016 at 9:27
8 Answers 8
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:
composer update
Then run:
php bin/magento setup:upgrade
And finally re-deploy the static files, which for me is this command:
php bin/magento setup:static-content:deploy de_DE en_US
That worked for me.
-
Thank you very much tecjam, this helped me alot! I was looking for a way to update for about one week. Greetings from Germany!Java_Waldi– Java_Waldi2016年01月27日 20:01:38 +00:00Commented Jan 27, 2016 at 20:01
-
Great Answer. Given steps are very simple to follow.Maniprakash Chinnasamy– Maniprakash Chinnasamy2017年03月17日 05:09:24 +00:00Commented Mar 17, 2017 at 5:09
-
5There is no need to empty the vendor dir.mniess– mniess2017年12月07日 16:54:02 +00:00Commented Dec 7, 2017 at 16:54
-
When update command is run,it show error :[Symfony\Component\Console\Exception\CommandNotFoundException] Command "composer" is not defined.Lovely Setia– Lovely Setia2018年12月24日 12:54:24 +00:00Commented Dec 24, 2018 at 12:54
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
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
php bin/magento maintenance:disable
After upgrade, check your Magento version with the following command:
php bin/magento --version
Upgrading to Magento 2.3.x
The above commands work fine while upgrading Magento to 2.2.x.
To upgrade to Magento 2.3.x, you need to follow some more steps.
Here's the step-by-step guide to upgrade Magento to 2.3.x:
Enable maintenance mode
php bin/magento maintenance:enable
Specify Magento packages
composer require magento/product-community-edition=2.3.0 --no-update
Specify additional packages
composer require --dev phpunit/phpunit:~6.2.0 friendsofphp/php-cs-fixer:~2.10.1 lusitanian/oauth:~0.8.10 pdepend/pdepend:2.5.2 sebastian/phpcpd:~3.0.0 squizlabs/php_codesniffer:3.2.2 --no-update
Remove unused packages
composer remove --dev sjparkinson/static-review fabpot/php-cs-fixer --no-update
Update autoload
Open composer.json and edit the "autoload": "psr-4" section to include "Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/":
"autoload": {
"psr-4": {
"Magento\\Framework\\": "lib/internal/Magento/Framework/",
"Magento\\Setup\\": "setup/src/Magento/Setup/",
"Magento\\": "app/code/Magento/",
"Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"
},
...
}
Apply updates
composer update
Clean the Magento cache
php bin/magento cache:clean
Manually clear caches and generated content
Clear the var and generated subdirectories:
rm -rf <Magento install dir>/var/cache/*
rm -rf <Magento install dir>/var/page_cache/*
rm -rf <Magento install dir>/generated/code/*
If you use a cache storage other than the filesystem, such as Redis or Memcached, you must manually clear the cache there too.
Update the database schema and data
php bin/magento setup:upgrade
Disable maintenance mode
php bin/magento maintenance:disable
Finally, check your Magento version
php bin/magento --version
Read more: https://devdocs.magento.com/guides/v2.3/comp-mgr/cli/cli-upgrade.html
-
2
-
1Don't you need to do a
n98-magerun2 setup:static-content:deploy en_US?Jeroen Vermeulen– Jeroen Vermeulen2017年07月18日 08:31:08 +00:00Commented Jul 18, 2017 at 8:31 -
1For me, the command
composer requiremessed up everything.magentocommand is missing frombinas well.Dyin– Dyin2017年08月17日 05:37:11 +00:00Commented Aug 17, 2017 at 5:37 -
1After following your steps it says "Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. Please read devdocs.magento.com/guides/v1.0/install-gde/…" I have PHP 7.1.11Wasiq Shahrukh– Wasiq Shahrukh2017年11月17日 10:45:41 +00:00Commented Nov 17, 2017 at 10:45
-
3I found this answer more useful than others. Already used it 4 times upgrading various minor M2 versions without any issue. Upvote this!!Kalpesh– Kalpesh2018年05月03日 21:01:04 +00:00Commented May 3, 2018 at 21:01
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 same command can be run if using Enterprise. For example:
composer require magento/product-enterprise-edition 2.0.6 --no-update
After running the relevant command, run
composer update
When composer has finished, upgrade your database by running the command:
php bin/magento setup:upgrade
As ever, make a backup of your database and use a versioning tool such as git to protect yourself from the upgrade not going to plan.
-
Hello, I refer your comment and getting error. you can see below error. The requested package magento/product-enterprise-edition 2.0.6 exists as magento/product-enterprise-edition[2.0.2] but these are rejected by your constraint. can you please help to solve this issue.Kartik Asodariya– Kartik Asodariya2017年02月21日 06:45:31 +00:00Commented Feb 21, 2017 at 6:45
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 sample data modules in Magento
bin/magento sampledata:reset- if you get an ErrorException about not found composer.json files, see: bin/magento sampledata:reset tries to read nonexistent composer.json
Update composer.json without immediately updating dependencies (this would result in a conflict because the old magento module versions are still locked). For 2.0.7:
composer require --no-update magento/product-community-edition ~2.0.7or for the latest 2.1 release candidate
composer require --no-update magento/product-community-edition 2.1.0-rc3[only if you update to>=2.1] Remove the sample data modules from
composer.json:"magento/module-bundle-sample-data": "100.0.*", "magento/module-theme-sample-data": "100.0.*", "magento/module-widget-sample-data": "100.0.*", "magento/module-catalog-sample-data": "100.0.*", "magento/module-customer-sample-data": "100.0.*", "magento/module-cms-sample-data": "100.0.*", "magento/module-catalog-rule-sample-data": "100.0.*", "magento/module-sales-rule-sample-data": "100.0.*", "magento/module-review-sample-data": "100.0.*", "magento/module-tax-sample-data": "100.0.*", "magento/module-sales-sample-data": "100.0.*", "magento/module-grouped-product-sample-data": "100.0.*", "magento/module-downloadable-sample-data": "100.0.*", "magento/module-msrp-sample-data": "100.0.*", "magento/module-configurable-sample-data": "100.0.*", "magento/module-product-links-sample-data": "100.0.*", "magento/module-wishlist-sample-data": "100.0.*", "magento/module-swatches-sample-data": "100.0.*", "magento/sample-data-media": "100.0.*", "magento/module-offline-shipping-sample-data": "100.0.*",Run the actual composer update:
composer update[only if you update to>=2.1] Reinstall sample data (you might need to apply the patch from (2) again):
bin/magento sampledata:deploy
-
when i run command
composer updateits asking for username and password, what this username and password are , if you can guide meAmit Dwivedi– Amit Dwivedi2017年03月02日 07:51:42 +00:00Commented Mar 2, 2017 at 7:51 -
Hi @amit_game: For some reason the repo.magento.com repository requires authentication. You can create your auth-keys on marketplace.magento.com using the following guide: devdocs.magento.com/guides/v2.0/install-gde/prereq/…tecjam– tecjam2017年05月22日 09:35:35 +00:00Commented May 22, 2017 at 9:35
Step By Step run following command
composer require magento/product-community-edition 2.1.6 --no-update
composer update
rm -rf var/di var/generation
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile(Optional)
php bin/magento indexer:reindex
chmod -R 777 var
php bin/magento setup:static-content:deploy
After upgrade, check your Magento version with the following command:
php bin/magento --version
Maybe you are missing something. First, connect your store with SSH. Now go to the root directory of your store.
Run all the commands one by one:
composer require magento/product-community-edition 2.1.3 --no-update
composer update
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/*
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
-
I already answered my own question, thanks. As you can see it was an issue with the first release of magento 2.0 - the documentation and issues have since been fixed.. An top of that I would never do a composer update directly on the server, never mind on the live shop.tecjam– tecjam2017年06月22日 09:22:17 +00:00Commented Jun 22, 2017 at 9:22
One can upgrade magento 2 using the two basic methods, one is from admin panel and other is using composer.
I've been using magento2 for a few months but I'm having trouble understanding how to update. Could anyone help me understand what this error means and how to fix it? BUT Upgrade should not install all updates automatically?
php bin/magento maintenance:enable
composer require magento/product-community-edition 2.4.6 --no-update
composer update --ignore-platform-reqs
*Loading composer repositories with package information Info from https://repo.packagist.org: #StandWithUkraine In Laminas\DependencyPlugin\DependencyRewriterV2:nPrePoolCreate Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1
- Root composer.json requires magento/product-community-edition 2.4.6 -> satisfiable by magento/product-community-edition[2.4.6].
- magento/product-community-edition 2.4.6 requires colinmollenhour/credis ^1.13 -> found colinmollenhour/credis[v1.13.0, v1.13.1, v1.14.0] but it conflicts with your root composer.json require (1.12.1).*
Thanks Alessandro