'PostgreSQL installation "Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed"

I recently uninstalled PostgreSQL 14.2 from my windows 10 computer. When I attempted to reinstall I run into the error: Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed.

On the install log I find this error:

Executing batch file 'rad27DAB.bat'...
    initdb: error: The program "postgres" was found by "C:/Program Files/PostgreSQL/14/bin/initdb.exe"
but was not the same version as initdb.
Check your installation.

Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb

However checking initdb.exe -V and postgres -V both return 14.2.

Before uninstalling postgres I had messed around with the console code page and from what I can find this could be an error, but I am not sure if there is an easy fix.

I believe this error prevents postgresql from being added to my services so it cannot run.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source