pert:
The Arduino Uno board is not compatible with the Keyboard library, which is why you got this error.
From https://www.arduino.cc/reference/en/language/functions/usb/keyboard/Another popular board with native USB is the Pro Micro (or Micro).
I have the pro micro