Note: Erase the flash drive to HFS+ (Mac OS Extended (Journaled)) but not APFS. The Terminal creates the installer drive on the opted USB flash drive. Warning: The command erases the flash drive so check there are no stored files backup the files, if they exist, before executing the sudo command.
When the download completes, quit the installer, as it will launch itself automatically.Download macOS Mojave 10.14 from App Store.