Angular: update to version 12 and problems with running the application on the current branch (with Angular 8)

I’m in the process of upgrading Angular in my application from version 8 to 12. Meanwhile there was a bug that needed a hotfix so I wanted to go back to the current branch which still has Angular 8 on it – I deleted the node_modules and dist folders, deleted the yarn.lock file, ran the yarn clean cache -all command and yarn install. Still it gives me errors like on the attached picture. I have no idea what else I can do, maybe someone encountered something similar?

enter image description here