I really believe you have a bad or weak ground. The gas cap wouldn't stop the engine from running. It can set an EVAP code for the emissions system, but thats it. You need to do the test at the starter to see if there is power to it when you turn the key to the start position. I am questioning the following things, the starter, starter relay, ignition switch. The starter is where you need to start.
Wednesday, January 16th, 2019 AT 5:39 PM