Same problem here.
First, make sure that you have no errors in your SQL scripts in:
modules/yourmodulename/sql/install.php.
modules/yourmodulename/upgrade/upgrade-x-x-x.php
* in most cases this will be the problem.
My problem was caused by removing the module manually. Basically I removed record from ps_module tabel manually and then removed the folder from modules catalog. Its seems that there is more references to this module in our database which might cause an issue.
To investigate the issue check if you have any left over after non existing's module installation in your database table.
SELECT ms.id_module as "ps_module_shop id_module" , m.id_module as "module id_module" FROM ps_module as m RIGHT JOIN ps_module_shop as ms ON m.id_module = ms.id_module WHERE m.id_module IS NULL;
DELETE LAFTOVERS FROM ALL TABLES:
DELETE FROM ps_module_shop WHERE id_module IN ( SELECT ms.id_module as "ms id" , m.id_module as "m id" FROM ps_module as m RIGHT JOIN ps_module_shop as ms ON m.id_module = ms.id_module WHERE m.id_module IS NULL; );
* The above sql will find all modules that does not exists in ps_module table but do exist in ps_module_shop table and removes them.
--------------------------------------
Now go to ps_hook_module table and remove the record in similar way. So run:
SELECT hm.id_module as "hm id" , m.id_module as "m id" FROM ps_module as m RIGHT JOIN ps_hook_module as hm ON m.id_module = hm.id_module WHERE m.id_module IS NULL; -- DELETE FROM ps_hook_module WHERE id_module IN (SELECT ...);
---------------------------------------
We could do the same for ps_module_history table
SELECT mh.id_module as "mh id" , m.id_module as "m id" FROM ps_module as m RIGHT JOIN ps_module_history as mh ON m.id_module = mh .id_module WHERE m.id_module IS NULL; -- DELETE FROM ps_module_history WHERE id_module IN (SELECT ...);
---------------------------------------
NOTE - If you remove module manually and try to reinstall it you might need to do this:
You should also see if there are any roles remained for you plugin name in ps_authorization_role table. My module name was "DEVWLH1" so this is what I search for. See the fallowing example:
SELECT * FROM `ps_authorization_role` WHERE slug LIKE "%DEVWLH1%";
* Just make sure to replace LIKE ... with your actual module name "%yourmodulname%";
*IMPORTNT! - Make a note of the IDs you will return (write them down before deleting them - you will need to know them in another table);
Then go to ps_module_access table and search for rows base on your previous findings from id_authorization_role table.
Now you can delete them from ps_module_access table, and then do the same in ps_authorization_role table.