magento-hackathon / magento-composer-installer

Composer installer for Magento modules
210 stars 154 forks source link

Fatal error: Call to undefined method MagentoHackathon\Composer\Magento\Installer::setDeployManager() #107

Open Flyingmana opened 10 years ago

Flyingmana commented 10 years ago

error message: Fatal error: Call to undefined method MagentoHackathon\Composer\Magento\Installer::setDeployManager()

Happens when you update from 1.x to 2.x, as we switched from pure installer to plugin.

Solution: remove the vendor directory and the composer.lock and do a fresh install.

sylvainraye commented 10 years ago

Should be in the README or an UPGRADE.md file instead to have it here. my 50cts Thanks

Flyingmana commented 10 years ago

a Pull Request is welcome :)

sylvainraye commented 10 years ago

Yes for sure :-) It was to see if we are agree ;-)

tkdb commented 10 years ago

I've running into this yesterday, here is a full report. TLDR: I only needed to run it two times, it recovered automatically (at least I think :) ):

USER@COMPUTER ~/PhpstormProjects/MyProject (compose-aoe-scheduler)
$ composer update --no-dev
Loading composer repositories with package information
Updating dependencies
  - Installing eloquent/liberator (1.1.1)
    Downloading: 100%

  - Installing eloquent/enumeration (5.1.0)
    Downloading: 100%

  - Installing eloquent/composer-config-reader (2.0.0)
    Downloading: 100%

  - Removing magento-hackathon/magento-composer-installer (1.3.2)
  - Installing magento-hackathon/magento-composer-installer (2.0.0)
    Downloading: 100%

PHP Fatal error:  Call to undefined method MagentoHackathon\Composer\Magento\Installer::setDeployManager() in C:\Users\DB\PhpstormProjects\MyProject\vendor\magento
-hackathon\magento-composer-installer\src\MagentoHackathon\Composer\Magento\Plugin.php on line 77
PHP Stack trace:
PHP   1. {main}() C:\ProgramData\ComposerSetup\bin\composer.phar:0
PHP   2. require() C:\ProgramData\ComposerSetup\bin\composer.phar:15
PHP   3. Composer\Console\Application->run() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
PHP   4. Symfony\Component\Console\Application->run() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:83
PHP   5. Composer\Console\Application->doRun() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.ph
p:121
PHP   6. Symfony\Component\Console\Application->doRun() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:117
PHP   7. Symfony\Component\Console\Application->doRunCommand() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Consol
e/Application.php:191
PHP   8. Symfony\Component\Console\Command\Command->run() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/App
lication.php:892
PHP   9. Composer\Command\UpdateCommand->execute() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Co
mmand.php:241
PHP  10. Composer\Installer->run() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/UpdateCommand.php:123
PHP  11. Composer\Installer->doInstall() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:214
PHP  12. Composer\Installer\InstallationManager->execute() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:540
PHP  13. Composer\Installer\InstallationManager->update() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationManager.php:140
PHP  14. Composer\Installer\PluginInstaller->install() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationManager.php:177
PHP  15. Composer\Plugin\PluginManager->registerPackage() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/PluginInstaller.php:65
PHP  16. Composer\Plugin\PluginManager->addPlugin() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php:235
PHP  17. MagentoHackathon\Composer\Magento\Plugin->activate() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php:81

Fatal error: Call to undefined method MagentoHackathon\Composer\Magento\Installer::setDeployManager() in C:\Users\DB\PhpstormProjects\MyProject\vendor\magento-hack
athon\magento-composer-installer\src\MagentoHackathon\Composer\Magento\Plugin.php on line 77

Call Stack:
    0.0219     238912   1. {main}() C:\ProgramData\ComposerSetup\bin\composer.phar:0
    0.0226     236480   2. require('phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer') C:\ProgramData\ComposerSetup\bin\composer.phar:15
    0.1178    1686856   3. Composer\Console\Application->run() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
    0.1294    1866736   4. Symfony\Component\Console\Application->run() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:8
3
    0.1339    1940120   5. Composer\Console\Application->doRun() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Cons
ole/Application.php:121
    0.1369    1989888   6. Symfony\Component\Console\Application->doRun() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php
:117
    0.1388    1990312   7. Symfony\Component\Console\Application->doRunCommand() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfon
y/Component/Console/Application.php:191
    0.1389    1990488   8. Symfony\Component\Console\Command\Command->run() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Com
ponent/Console/Application.php:892
    0.1416    1993088   9. Composer\Command\UpdateCommand->execute() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/
Console/Command/Command.php:241
    0.5271    4112432  10. Composer\Installer->run() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/UpdateCommand.php:123
    0.5338    4168760  11. Composer\Installer->doInstall() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:214
   15.0410   63912800  12. Composer\Installer\InstallationManager->execute() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:540
   15.0411   63912928  13. Composer\Installer\InstallationManager->update() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/Installatio
nManager.php:140
   15.3702   63917464  14. Composer\Installer\PluginInstaller->install() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationMa
nager.php:177
   17.4158   63921808  15. Composer\Plugin\PluginManager->registerPackage() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/PluginInsta
ller.php:65
   17.4337   63977816  16. Composer\Plugin\PluginManager->addPlugin() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginManager.php:23
5
   17.4337   63978144  17. MagentoHackathon\Composer\Magento\Plugin->activate() phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Plugin/PluginMana
ger.php:81

USER@COMPUTER ~/PhpstormProjects/MyProject (compose-aoe-scheduler)
$ composer update --no-dev
Loading composer repositories with package information
Updating dependencies
  - Removing magento-hackathon/magento-composer-installer (1.3.2)
  - Installing magento-hackathon/magento-composer-installer (2.0.0)
    Loading from cache

  - Installing fbrnc/aoe_scheduler (v0.3.2)
    Downloading: 100%

Writing lock file
Generating autoload files
Flyingmana commented 10 years ago

thx for the info, and also thx for testing it on windows :)

tkdb commented 10 years ago

Solution: remove the vendor directory and the composer.lock and do a fresh install.

We have composer.lock under version control - which is also suggested by the composer project. Therefore I don't think this suggestion is a good one, as the good suggestion is to keep composer.lock under version control - and not remove it just for update.

As far as my automatic deployment scripts are concerned, this could be handled as a special case, so I could program my deployment to deal with this, but I don't think this is reasonable in general.

By further testing I found out that updating it w/o plugins it does not crash:

$ composer update --no-plugins --no-dev "magento-hackathon/magento-composer-installer"
tkdb commented 10 years ago

Just from the backtrace: Can't we check in the plugin.php to not call this in case it's the removal? Or in case that method/class is not there? (I dunno if it would need a change in 1.3 or in 2.0).

This is my test-case: https://gist.github.com/tkdb/6e2982463ff225ca4b7b

Flyingmana commented 10 years ago

if you would like to submit a patch for this. In any case, this is a one time Issue and I dont think it is worth to invest much time into it

tkdb commented 10 years ago

right, upgrading to 2.0 now all my installs :)

Loxzibit commented 7 years ago

For ref: composer update --no-plugins --no-dev "magento-hackathon/magento-composer-installer" then composer update worked for me.

AntonEvers commented 6 years ago

composer clearcache, then composer update worked for me.

VishalParkash commented 3 years ago

Is there any solution to this problem? I have tried all the given solutions, but none worked for me. I am using magento 2.4

Flyingmana commented 3 years ago

@VishalParkash for magento 2.4 the correct repository would be https://github.com/magento/magento-composer-installer They use a forked version modified for use of Magento2, while this installer here does not support Magento 2