Try using Pandoc. I am not sure how "correct" is the HTML5...
$ pandoc file.epub -t html5 -s > file.html
Pandoc is open source. sudo apt install pandoc if not previously installed.
Without -s just the body's content is generated.
(Several options available to control html output)
It turns out the chapter file names were incorrectly listed in the OEBPS TOC.
I resolved the issue by:
Opening the first file (navigational TOC) in the OEBPS folder of the unpacked .ePub (.zip)
Correcting the 'h-#' portion of the href in each tag by incrementing by 1. For instance, the first href which was "@public@vhost@g@gutenberg@html@files@1250@1250-...
It looks like the anchor tags were put in the wrong place. If you unzip the .epub, you'll see that the link for Part 1
<p><a id="link2H_PART1"><!-- H2 anchor --></a></p>
is at the end of the first (navigational TOC) file, 1250-h-0.htm.html rather than the file for Part 1, 1250-h-1.htm.html.
If you move each of those links ...