An error occurred while uploading the sketch.

Hi,

I had the same problem and i just went to Tools+Port, and then selected the one that showed Arduino Genuino/UNO, in my case (i switched from port 13 to port 20).
It worked.

Regrads,