I had to update an old app which was using angular 16. After a series of updates, i finally got the app updated to version 20. After that I couldn't serve the app because of the above mentioned error.
What worked for me is replacing "browserTarget" with "buildTarget".