Magento – Adding Module Causes Install Screen

exceptionmagento2.2module

[EDIT]

Added screenshot showing can't run any of the CLI commands being suggested:

CLI not working

[/EDIT]

Implemented add new table official learning module (http://devdocs.magento.com/videos/fundamentals/add-a-new-table-to-database/) with no issues.

Implemented add new product attribute official learning module (http://devdocs.magento.com/videos/fundamentals/add-new-product-attribute/), and the # magento setup:upgrade step yields:

magento_user@ubuntu:/var/www/html/magento.dev/app/code/Learning/ClothingMaterial/Setup#
magento setup:upgrade
Notice: Undefined index: websites in /var/www/html/magento.dev/vendor/magento/module-config/App/Config/Type/System.php
on line 248

Now I'm getting the install screen when I visit the store.

Welcome to Magento Admin, your online store headquarters. Click
'Agree and Set Up Magento' or read Getting Started to learn more.

Tried uninstalling the module # magento module:disable Learning_ClothingMaterial --clear-static-content and re-running # magento setup:upgrade amd # magento setup:di:compile but upgrade yields same error as above and compile yields:

[Exception] Warning: array_replace_recursive(): Argument #1 is not
an array in /var/www/html/magento.dev/vendor/magento/fram
ework/App/DeploymentConfig/Writer.php on line 135

It's impressive that following along with an official tutorial causes this level of destruction. Really hope there's an easy fix, as have had to re-install a half-dozen times now due to very similar issues.

Env: a vanilla composer CE 2.2 sandbox, on a bare metal Ubuntu 16 LAMP with PHP 7.1.

Best Answer

If you want to uninstall it:

-> go to Database

-> go to setup_module

-> find Learning_ClothingMaterial

-> delete row

-> clear cache with php bin/magento cache:clean

-> clear generated by deleting content of the folder /generated

-> run setup upgrade with php bin/magento setup:upgrade

-> recompile website with php bin/magento setup:static-content:deploy

Update

Not sure why you do not need to use php bin/magento because the magento commands should be in the bin folder.

I can tell you in developer mode you need to add '-f' to the command like php bin/magento -f setup:static-content:deploy

I can also tell you if its not the bin/magento and you are still getting the 'there are no commands defined in the ... namespace' it means that a class was not used (on top of you php file you need to include your classes by adding 'use Magento/.../..." or badly used in the __construct of your php files.

You can just delete the module files and directories that you created , delete the setup_module and recompile.

If you want to get the module working then you need to go and comment out every class that you used until it works.

To provide more assistance on that i will need to see your code.

Related Topic