Hello, this is my first contribution to the list, so I hope it is useful!
I've found on stackoverflow an useful clue:
https://stackoverflow.com/questions/70027316/firebase-function-failing-to-deployIn my case, the package-lock.json was corrupted because:
1. a contributor switched 2 times the lockfileVersion from version 2 to 1 and then again from 1 to 2
2. they was using a deprecated package (crypto) that is not required anymore because it is integrated in Node.js core already.
So, I checked out the package.json and package-lock.json from a previous deployment, and then rebuilt and deployed again the functions.
Everything works fine now.
Best regards and Happy New Year!
Jesus Franco
Levo.mx