I hope this post will solve the issue if you run into it.
If you trying to install macOS High Sierra / El Capitan on an older like 2010 / 2011 or older. You get the Failure-message mentioned above and if you try to create an macOS-USB-Stick and run the installation from it the message is like “MacOS could not be installed on your computer”.