Effective chest compressions need to push the breastbone down by at least 5 to 6 centimetres, hard and fast. That amount of force can crack or break ribs, particularly in older people or those with weaker bones. It is a common and well recognised consequence of CPR, not a sign that anything was done wrong.
Rib fractures are painful and can take weeks to heal, but they are rarely life threatening. The alternative, compressions that are too shallow, would not circulate blood to the brain and vital organs. If you performed CPR and ribs broke, you did it right. If you survived a cardiac arrest and your chest hurts, that pain is part of the price of being alive, and it will ease with time.