I’ve been cursed with this error I think every major upgrade since the migration from ownCloud to Nextcloud a couple of years ago. I have another posting on disabling this check on a previous version. It makes me not want to run the upgrades because they always fail. I’m unsure what check it’s finding that incorrectly flags the existing installed version, no matter what that version is, and halts the upgrade.
But, for version Nextcloud version 14, there is a different area of the Updater.php to comment-out. At around line 211, you can just add comment-out the three lines doing the check and trigger a halt to the upgrade process.
The file you need to modify is in this path:
Once you do that, you can complete the upgrade either via the web upgrade or via the ./occ shell commands.