0

I wanted to install a new extension in my store and I keep on getting this error in CLI.

An exception was raised while creating "Application"; no instance returned#0 Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'a
pplication', 'Application')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('application', 'Application')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('Application', 'application')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
Sites\XXXXX\vendor\zendframework\zend-mvc\src\Application.php(261): Zend\ServiceManager\ServiceManager->get('Application')
Sites\XXXXX\vendor\magento\framework\Console\Cli.php(57): Zend\Mvc\Application::init(Array)
Sites\XXXXX\bin\magento(21): Magento\Framework\Console\Cli->__construct('Magento CLI')
#7 {main}

An exception was raised while creating "Request"; no instance returned#0 Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'reque
st', 'Request')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('request', 'Request')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('Request', 'request')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
Sites\XXXXX\vendor\zendframework\zend-mvc\src\Application.php(113): Zend\ServiceManager\ServiceManager->get('Request')
Sites\XXXXX\vendor\zendframework\zend-mvc\src\Service\ApplicationFactory.php(29): Zend\Mvc\Application->__construct(Array, Object(Zend\ServiceManager\ServiceManager))
[internal function]: Zend\Mvc\Service\ApplicationFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'application', 'Application')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(939): call_user_func(Array, Object(Zend\ServiceManager\ServiceManager), 'application', 'Application')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'application', 'Application')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('application', 'Application')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('Application', 'application')
Sites\XXXXX\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
Sites\XXXXX\vendor\zendframework\zend-mvc\src\Application.php(261): Zend\ServiceManager\ServiceManager->get('Application')
Sites\XXXXX\vendor\magento\framework\Console\Cli.php(57): Zend\Mvc\Application::init(Array)
Sites\XXXXX\bin\magento(21): Magento\Framework\Console\Cli->__construct('Magento CLI')
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in D:\Sites\XXXXXX\vendor\zendframework\zend-stdlib\src\ArrayObject.php on line 426#0 D:\Sites\XXXXXXvendor\composer\ClassLoader
.php(444): Magento\Framework\App\ErrorHandler->handler(2, '"continue" targ...', 'D:\\Sites\\xxx...', 426, Array)
#1 D:\Sites\XXXXXXvendor\composer\ClassLoader.php(444): include()
#2 D:\Sites\XXXXXXvendor\composer\ClassLoader.php(322): Composer\Autoload\includeFile('D:\\Sites\\xxx...')
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass('Zend\\Stdlib\\Arr...')
#4 D:\Sites\XXXXXXvendor\zendframework\zend-stdlib\src\Parameters.php(29): spl_autoload_call('Zend\\Stdlib\\Arr...')
#5 D:\Sites\XXXXXXvendor\zendframework\zend-console\src\Request.php(96): Zend\Stdlib\Parameters->__construct()
#6 D:\Sites\XXXXXXvendor\zendframework\zend-console\src\Request.php(122): Zend\Console\Request->getParams()
#7 D:\Sites\XXXXXXvendor\zendframework\zend-console\src\Request.php(66): Zend\Console\Request->params()
#8 D:\Sites\XXXXXXvendor\zendframework\zend-mvc\src\Service\RequestFactory.php(29): Zend\Console\Request->__construct()
#9 [internal function]: Zend\Mvc\Service\RequestFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'request', 'Request')
#10 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(939): call_user_func(Array, Object(Zend\ServiceManager\ServiceManager), 'request', 'Request')
#11 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'request', 'Request')
#12 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('request', 'Request')
#13 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('Request', 'request')
#14 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#15 D:\Sites\XXXXXXvendor\zendframework\zend-mvc\src\Application.php(113): Zend\ServiceManager\ServiceManager->get('Request')
#16 D:\Sites\XXXXXXvendor\zendframework\zend-mvc\src\Service\ApplicationFactory.php(29): Zend\Mvc\Application->__construct(Array, Object(Zend\ServiceManager\ServiceManager))
#17 [internal function]: Zend\Mvc\Service\ApplicationFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'application', 'Application')
#18 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(939): call_user_func(Array, Object(Zend\ServiceManager\ServiceManager), 'application', 'Application')
#19 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'application', 'Application')
#20 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('application', 'Application')
#21 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('Application', 'application')
#22 D:\Sites\XXXXXXvendor\zendframework\zend-servicemanager\src\ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#23 D:\Sites\XXXXXXvendor\zendframework\zend-mvc\src\Application.php(261): Zend\ServiceManager\ServiceManager->get('Application')
#24 D:\Sites\XXXXXXvendor\magento\framework\Console\Cli.php(57): Zend\Mvc\Application::init(Array)
#25 D:\Sites\XXXXXXbin\magento(21): Magento\Framework\Console\Cli->__construct('Magento CLI')
#26 {main}


Fatal error: Uncaught Error: Class 'Cli' not found in D:\Sites\XXXXXXbin\magento:30
Stack trace:
#0 {main}
  thrown in D:\Sites\XXXXXXbin\magento on line 30

I did Remove the extension from \app\code but this issue remains. I can't run any Magento CMDs. Any advice is appreciated.

0

Cleaning the generated files might solve it, try to run these sequence of commands below. Check the server requirements too.

php bin/magento deploy:mode:set developer ;
rm -rf vendor/* generated/* var/* pub/static/* ;
composer install ;
php bin/magento setup:upgrade ;
  • By running the first cmd, won't it break the website if it did that update? I don't want to update nor upgrade this version of Magento. Thanks for the reply. – Notsobad Oct 11 at 19:52
  • It won't update the Magento version, it'll update the core components, fixing issues and adding improvements, with no updates in the Magento version. If there is some manual change in the core it will fix it. – Rafael Corrêa Gomes Oct 11 at 20:00
  • I did that and the website is dow shows error "Vendor autoload is not found. Please run 'composer install' under the application root directory." when I run composer install I keep on getting this error "$ composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them. [ErrorException] – Notsobad Oct 14 at 12:18
  • "continue" targeting switch is equivalent to "break". Did you mean to use " continue 2"? install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] ....." any advice? – Notsobad Oct 14 at 12:18
  • 1
    @Rafeal, Thank you, I got my environment working properly. I also got my CLI to work with the correct version of PHP. Thanks for the help. You rock man. – Notsobad Oct 16 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.