I installed a local Magento environment on XAMPP using composer. The database is also running on XAMPP (MySql). After the (web) setup i found out that the static files where not generated yet so I tried to run following command:

php bin/magento setup:static-content:deploy -f

I got the "There are no commands defined in the "setup" namespace." error. After that I tried running cache:clear but I got the same error.

When I run

php bin/magento

I got 3 error message along with some normal info. The error message are the following:

[Zend\ServiceManager\Exception\ServiceNotCreatedException] An abstract factory could not create an instance of magentosetupconsolecommandconfigsetcommand(alias: Magento\Setup\Console\Command\ConfigSetCommand).

[Zend\ServiceManager\Exception\ServiceNotCreatedException] An exception was raised while creating "Magento\Setup\Console\Command\ConfigSetCommand"; no instance returned 

[Magento\Framework\Exception\FileSystemException] Cannot read contents from file "C:\xampp\htdocs\magitas\app\code\duo\main\etc\module.xml" Warning!file_get_contents(C:\xampp\htdocs\magitas\app\code\duo\main\etc\module.xml): failed to open stream: No such file or directory

I have the correct user rights (otherwise my setup would not have run).



Found the solution, and I'm a little embarrassed to be honest. It was because the module.xml file was not created in one of my custom modules

| improve this answer | |

You can try xampp shell to execute commands for Magento.

Check here : Magento 2 : How to install Porto theme using command prompt in Localhost?

| improve this answer | |
  • I am using the xampp shell it gives the same output unfortunately – Arno Vande Cappelle Sep 7 '18 at 11:58
  • Did you set enviroment variable for your PHP installation ? – TBS Mage Sep 7 '18 at 11:59
  • I didn't but I checked and it's set to c:/xampp/php – Arno Vande Cappelle Sep 7 '18 at 12:04
  • I've edited my answer please follow accepted answer It will definitely solve your problems for CLI. – TBS Mage Sep 7 '18 at 12:06
  • No it doesn't I get the "There are no commands defined in the "setup" namespace." error – Arno Vande Cappelle Sep 7 '18 at 12:10

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.