Unable to synchronize nodes

I have followed the above steps to run the node, but I get a log message “TreeState: Database invariant violation: Could not read last finalized block” and the node cannot be synchronized, so I cannot use the Testnet Wallet.
Please let me know how to fix this.

Have you tried following these recovery instructions Troubleshoot a node on MacOS — Concordium documentation ?

That is currently the only way to recover. It looks like your database was corrupted. A common way that happens is if the node is killed without giving it the opportunity to shut down properly.