\.platformio\packages\framework-arduino-avr\cores\arduino\Arduino.h:233:10: fatal error: HardwareSerial.h: No such file or directory

For some reason I have started getting the following error regardless of what project I have opened even those which no dependencies. How can I fix this. ( The file it refers to does exist )

In file included from C:\Users\USERNAME\.platformio\packages\framework-arduino-avr\cores\arduino\USBAPI.h:33:0,
                 from C:\Users\USERNAME\.platformio\packages\framework-arduino-avr\cores\arduino\USBCore.cpp:20:
C:\Users\Terry\.platformio\packages\framework-arduino-avr\cores\arduino\Arduino.h:233:10: fatal error: HardwareSerial.h: No such file or directory

/** UPDATE **/

I tried a clean uninstall and reinstall, and even with a virgin project I still get the the error.

*************************************************************************
* Looking for HardwareSerial1.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:HardwareSerial1.h"
* Web  > https://registry.platformio.org/search?q=header:HardwareSerial1.h
*
*************************************************************************

 #include "HardwareSerial1.h"
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\nanoatmega328new\FrameworkArduino\HardwareSerial1.cpp.o] Error 1
======================================================================================== [FAILED] Took 1.68 seconds ========================================================================================
 *  The terminal process "C:\Users\USER\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Thanks

This just screams “corrupted package”. Delete the C:\Users\Terry\.platformio\packages\framework-arduino-avr\ folder along with C:\Users\Terry\.platformio\.cache completely and press the build button again.