The first thing to do is to see if it is a power supply problem. You don't say whether it is a laptop or desktop? If it is a laptop does it happen when you do not have the power lead attached? If it is a desktop have you tried another power lead just in case it is faulty?
Nokia 8 vs Galaxy S8