+1, resetting package caches seems to be the only, albeit temporary, remedy for me too. Though unlike @beeef, I only get the build errors occasionally. I haven't dug deeper into it but Package.resolved is definitely at the center of the issue because I've noticed it being modified after resetting package caches, which makes the errors go away.
Post
Replies
Boosts
Views
Activity
This was not supposed to be a post but a reply to a different thread. The Forums UI is super confusing and restrictive. For instance, I tried to delete this post (I'm the thread owner), and I can't so if there is a moderator or some bot who can understand this request, please delete this thread as it was posted in error.
+1 to everyone here. While the thread has been viewed thousands of times, there aren't really that many actual posts (and that's across 6+ years) so I wonder if this is a much smaller issue than it seems. Alternatively, I wonder if this isn't the right place to file this issue in the first place. To rule out the latter possibility, I went ahead and opened a ticket to Apple via the Feedback Assistant (case ID FB13585955) where I also referenced this thread. If I hear back from them (not sure how public the feedback tickets are), I'll try to update this thread with the findings.
Even if this issue doesn't affect many developers, I hope Apple will at least provide us with some debug steps. Otherwise, it's just educated guesses, which is very time-consuming (and wasteful).