Error with displaying on serials monitor

if you get errormessages before uploading has finished it is NOT a problem of your code. Your code is not executing through upload it must be a problem of the upload-process.
the most common advice for all modern electronic equipment is: install new and reboot all devices. This means install Arduino ide new

best regards Stefan